Agents Lookup

Use cases / IT & DevOps

Review and improve Dockerfiles

Ask Docker's assistant to explain a Dockerfile, shrink the image, fix build errors or suggest safer base images.

DifficultyBeginner
Setup timeUnder 1 hour
CategoryIT & DevOps

The use case

Dockerfiles get copied between projects and pick up bloat and bad habits: running as root, huge base images, no layer caching. Gordon, Docker's AI assistant in Docker Desktop and the CLI, can explain a Dockerfile, suggest changes such as multi-stage builds or smaller bases, help with failed builds and answer container questions using local context. It can make changes after you approve them. A developer still rebuilds the image, runs tests, and checks that the new base image is supported and scanned before shipping.

Example workflow

  1. Open the project and ask the assistant to review the Dockerfile
  2. Read suggested changes and the reasons
  3. Approve edits you agree with
  4. Rebuild and run tests
  5. Scan the image before pushing

Tools

Risks and guardrails

Sources

Written by Agents Lookup. Credits and official pages for the tools this use case names: