Add usage of strict shell (#1841)

Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
This commit is contained in:
OmegaSquad82 2022-06-09 04:11:24 +02:00 committed by GitHub
parent b50655f6dc
commit 5b68e050e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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