docs
docs copied to clipboard
docs: Add sh/bash example for SHELL
Is this a docs issue?
- [x] My issue is about the documentation content or website
Type of issue
I can't find what I'm looking for
Description
Hadolint points to the online documentation for the SHELL directive. Which is good.
However, all that's given here is a powershell example.
That might be useful on windows or dotnet related dockerfiles, but not so handy for linux ones.
Location
https://docs.docker.com/reference/dockerfile/
Suggestion
Maybe a more detailed example based on the moby repo?:
SHELL ["/bin/bash", "-c"]
RUN echo I am now using bash!
This is me taking a stab at setting shell flags and options
# syntax=docker/dockerfile:1.7.0
FROM ubuntu:latest
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN <<EOF
#!/bin/bash
# set -euxo pipefail
echo "Shell: ${SHELL}" > /tmp/test.txt
echo "Shell options after explicit set: ${-}" >> /tmp/test.txt
echo "Detailed shell options:" >> /tmp/test.txt
set -o >> /tmp/test.txt
EOF
CMD ["cat", "/tmp/test.txt"]
which doesn't work as expected without uncommenting the inline set opts.
Shell: /bin/bash
Shell options after explicit set: hB
Detailed shell options:
allexport off
braceexpand on
emacs off
errexit off
errtrace off
functrace off
hashall on
histexpand off
history off
ignoreeof off
interactive-comments on
keyword off
monitor off
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged off
verbose off
vi off
xtrace off