
- Updated
Review and improve a Dockerfile
This prompt reviews a Dockerfile for an app type and language, and suggests improvements.
Review this Dockerfile: [PASTE DOCKERFILE] The app: [APP TYPE AND LANGUAGE] Check for security issues, image size, build caching, unnecessary layers, running as root and missing health checks. Provide an improved version with comments explaining every change and any behaviour I should test.
Ask for the image size before and after to see how much the changes really save.
Get a better result
A review of your Dockerfile covering security, image size, build caching, extra layers, running as root and health checks, then an improved version with a comment on each change and what to test.
Dockerfiles quietly collect problems: running as root, large images and cache-busting layer order. The prompt lists each of those so the review is complete, and asks for comments on every change so you understand them. Asking what behaviour to test matters because many improvements change how the container runs.
The new base image breaks your app.
Fix: Switching to a slim or Alpine image can remove libraries you need. Build and run the tests before you merge.
- The non-root user cannot write where the app needs to. Check folders the app writes to, such as logs or uploads, and give that user permission.
- You cannot tell how much it saved. Ask for the image size before and after, as the tip says, and check it yourself with your build.
Paste your compose file too and ask for a review of ports, secrets in environment variables and restart policies.
Split the improved file into a multi-stage build that keeps build tools out of the final image, and explain what each stage copies.
More chat & writing prompts
See all 465 →More like this
- Write a Dockerfile for your appClaude · ChatGPT · Claude Code
- Improve any AI prompt before you send itChatGPT · Gemini · Claude
- Review a database schema before it goes liveClaude · ChatGPT · Gemini
- Year in review photo collageGemini · ChatGPT
- Review a pull request diff before you mergeClaude · ChatGPT · Claude Code



