fleetlint Policy for a fleet of repositories
v0.9
Getting started

containers/dockerignore

Container builds have a .dockerignore

Severitywarning
Tiersall
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.6.0
Selected byfleetlint-recommended@v0.6.0

Requirement

A repository with a Dockerfile has a .dockerignore that keeps .git, secrets and build output out of the build context.

Why

Without it the whole working tree, including .env files and the git history, is sent to the builder and can end up in a layer.

Applies when

tracked().exists(p, p.matches("(^|/)((Dockerfile|Containerfile)[^/]*|[^/]+\\.(Dockerfile|Containerfile|dockerfile|containerfile))$"))

Check

file(".dockerignore") || file(".containerignore") || exists("*.dockerignore")

Fix

Add .dockerignore listing .git, .env*, build output and anything the image does not need.

Agent instruction: Add .dockerignore with .git, .env*, the stack’s build output and dependency directories; check that the image still builds.

A finding of this rule points at .dockerignore.

Sources


Generated by fleetlint docs from catalog v0.6.0.