Dockerfile Review and Hardening

Improve image size, speed and safety.

Added October 15, 2026. Written with AI assistance and checked for clarity and placeholders; not reviewed by a lawyer, accountant, clinician or other professional. How these prompts are made

The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.

Review and improve my Dockerfile. Paste it with any secrets removed: [DOCKERFILE]. Application type and runtime: [APP_TYPE]. Where the image runs: [RUNTIME_ENVIRONMENT].

Return findings in a table: Line | Issue | Why it matters | Fix. Check base image choice and pinning by digest, multi-stage builds, layer ordering for cache efficiency, running as a non-root user, minimal packages, no secrets in layers, health checks, signal handling, and a .dockerignore. Provide the revised Dockerfile with comments, then estimate qualitatively the size and build time effects, and tell me how to measure them (commands to inspect layers and size). Add a scan step to run in CI and a policy for base image updates. Flag anything that depends on my platform for verification.

Add a short list of questions to ask if my application has special needs, such as native dependencies, large static assets, or multiple processes, and describe how the Dockerfile would change. Provide a table of three alternative base image strategies with trade-offs for size, patching speed, and debugging. Close with a test I can run to verify that the container runs as a non-root user.

Fill in before use

Optional: type your details and the prompt above updates. Nothing is saved or sent.

Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.

Rate this prompt

Related prompts