Sign inSign up

koalaman/shellcheck

By koalaman

•Updated 1 day ago

ShellCheck -- Shell script analysis tool

Image
43

10M+

koalaman/shellcheck repository overview

⁠koalaman/shellcheck

This is the official Docker image for ShellCheck⁠, a static analysis tool for shell scripts.

⁠USAGE

⁠Run the latest git commit from the command line

$ 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

⁠Create a shell alias

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

⁠Incorporate into your CI workflow

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.)

⁠Run with Linux utilities

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.

⁠Include in your own Docker image

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/

Tag summary

Content type

Image

Digest

sha256:bbc8c99df…

Size

3.9 MB

Last updated

1 day ago

docker pull koalaman/shellcheck