Skip to content

Commit

Permalink
Add usage of strict shell (rstacruz#1841)
Browse files Browse the repository at this point in the history
Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
  • Loading branch information
OmegaSquad82 and rstacruz authored Jun 9, 2022
1 parent b50655f commit 5b68e05
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dockerfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ ADD file.xyz /file.xyz
COPY --chown=user:group host_file.xyz /path/container_file.xyz
```

### Run commands in strict shell

```docker
ENV my_var
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
# With strict mode:
RUN false # fails build like using &&
RUN echo "$myvar" # will throw error due to typo
RUN true | false # will bail out of pipe
```

Using `shell` will turn on strict mode for shell commands.

### Onbuild

```docker
Expand Down

0 comments on commit 5b68e05

Please sign in to comment.