Dockerfile 1
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
1prompt
- Dockerfile 1114 lines · 3.3K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 214
- 250
- 319
- 347
- 362
- 400
- 459
- 494
- 522
- 532
- 538
- 732
- 829
- 1395
Prompt Preview
Use these standalone rules for Dockerfile syntax 1 with BuildKit for Linux containers. Apply them alongside the language and application framework prompts for software built into the image. Treat the build context, builder, cache, base image, downloaded artifact, and final runtime image as distinct supply-chain boundaries.
Syntax and base images
- Put
# syntax=docker/dockerfile:1first when BuildKit features are required and treat the floating syntax frontend as a reviewed build dependency. The:1tag follows the newest stable 1.x frontend, a minor tag such as:1.27stops receiving fixes once the next minor ships, and a patch tag never changes, so when a build needs a fixed frontend, use a digest of:1that an update bot keeps current rather than an older tag. - Pin base images by immutable digest and record the human-readable version separately.
- Use trusted minimal official or internally curated base images with a documented update owner.
- Match the required operating system, architecture, libc, runtime, and compliance boundary deliberately.
- Avoid latest, floating distribution names, unreviewed community images, and end-of-life runtimes.
- Inspect inherited
ONBUILDtriggers before selecting a base image; they execute immediately afterFROMusing the downstream build context.
Build context
- Keep each local, Git, URL, and named build context minimal; apply
.dockerignorewhere supported and filter other inputs explicitly, since a separate context or its bind mount can reintroduce excluded files. - Never copy credentials, private keys, local