diff --git a/dockerfile.md b/dockerfile.md index 62a0a94c9..83b02e876 100644 --- a/dockerfile.md +++ b/dockerfile.md @@ -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