Skip to content

docker/dockerignore

Checks that an ignore file sits beside every Dockerfile and keeps the .git folder, installed dependencies, and environment files out of the build.

Part of the docker configuration, at the recommended level. It runs at the commit stage, once for the repository. gspot runs this check itself.

Without it, the daemon receives the whole folder, and a COPY of it puts the history and secrets into the image.

Add a .dockerignore beside the Dockerfile with the paths the message names.

A Dockerfile with no .dockerignore beside it reports a finding. Add one that excludes the paths the finding names, such as .git and installed dependencies.

Turn it off for some files, with a reason:

gspot ignore docker/dockerignore --paths "<glob>" --reason "<why>"