fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

containers/dockerignore

Container builds have a .dockerignore

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

Requirement

A repository with a Dockerfile or Containerfile has a .dockerignore or .containerignore at the root, or a per-Dockerfile *.dockerignore; what it excludes is not checked.

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, so they stay out of the build context.

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

A finding that names no file points at .dockerignore.

Sources


Generated by fleetlint docs from catalog v0.8.0.