Docker .gitignore Template
The full, current Docker .gitignore template — copy it as-is, or head to the .gitignore Generator to merge it with other stacks into one file.
Template
# Docker .docker/ docker-compose.override.yml docker-compose.*.local.yml *.env !*.env.example
What each entry does
Why every line in this template is excluded, not just what it matches.
| Entry | Why it's excluded |
|---|---|
| .docker/ | A generated/local directory (.docker) — excluded because its contents are either build output or machine-specific state, not source you'd want to review in a diff. |
| docker-compose.override.yml | A local override of docker-compose.yml (ports, volumes, env) meant to differ per developer machine. |
| docker-compose.*.local.yml | Files matching docker-compose.*.local.yml — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| *.env | Files matching *.env — a generated or machine-specific file type for this stack, safe to regenerate rather than track. |
| !*.env.example | Re-includes *.env.example — carves out an exception to a broader exclusion pattern above it. |