koalaman/shellcheck
ShellCheck -- Shell script analysis tool
10M+
This is the official Docker image for ShellCheck, a static analysis tool for shell scripts.
$ docker run --rm -it -v "$(pwd):/mnt" koalaman/shellcheck:latest --version
ShellCheck - shell script analysis tool
version: v0.10.0-62-g3c75d82
license: GNU General Public License, version 3
website: https://www.shellcheck.net
Add the following to your .bashrc
or equivalent:
alias shellcheck='docker run --rm -it -v "$(pwd):/mnt" koalaman/shellcheck:stable'
then restart your terminal and run shellcheck --version
By glob:
$ docker run --rm -it -v "$(pwd):/mnt" koalaman/shellcheck:stable *.sh
Or recursively, by filename:
find . -name '*.sh' -exec docker run --rm -it -v "$(pwd):/mnt" koalaman/shellcheck:stable {} +
Or recursively, trying to recognize shebangs:
find . -type f -exec grep -q '^#!.*sh' {} \; -exec docker run --rm -it -v "$(pwd):/mnt" koalaman/shellcheck:stable {} +
For smarter script identification and version auto-upgrade, check out the shellcheck pre-commit plugin.
(Tip: replace stable
with a specific version like v0.10.0
to avoid breaking your build when a new version is released.)
Note that this image does not contain any Unix userspace utilities.
If you prefer that, check out koalaman/shellcheck-alpine. That Docker image has an Alpine Linux set of userspace tools, with the shellcheck binary added.
You can copy the statically linked shellcheck
binary into your own image, such as with this minimal Dockerfile
:
FROM alpine:latest
COPY --from=koalaman/shellcheck:stable /bin/shellcheck /bin/
docker pull koalaman/shellcheck