Dockerfiles seem to support a limited subset of shell scripts (and shell scripts can be embedded, which is currently quite nasty). It might be good to add this feature at some pont.
Dockerfiles are not shell files they are config files for which there are already a few validators. Mixing languages is a bug; all shell scripts in dockerfiles should be called with
RUN ex.sh
@Dmole Would you call Dockerfiles and Makefiles actually used in many projects bugs too? I think the issue is not about what and who should use.
I would also like to lint embedded scripts (but it's not trivial and quite specific, so I doubt it will be implemented in shellcheck itself). A workaround for such cases is to use a wrapper than conditionally turn files into temporary scripts before linting them. As an illustration (really quick and dirty):
shellcheck -s bash <(sed 's/^RUN //;' Dockerfile) (or even just shellcheck Dockerfile)shellcheck -s bash <(perl -pe 's/^(?!\t).*//' Makefile) (the substitution is to preserve line numbers)You'll love hadolint!
It's a linting tool for Dockerfiles, and it uses ShellCheck for RUN statements.
Most helpful comment
You'll love hadolint!
It's a linting tool for Dockerfiles, and it uses ShellCheck for RUN statements.