Build a Docker image from a Dockerfile

domain: docs.docker.com · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Confirm a Dockerfile exists in the build context (default file is PATH/Dockerfile).
  2. Build and tag: `docker build -t myapp:latest .` (docker build / docker builder build / docker image build are aliases of docker buildx build, which uses BuildKit).
  3. Use a specific Dockerfile: `docker build -f ./docker/prod.Dockerfile -t myapp:latest .`.
  4. Skip the layer cache: `docker build --no-cache -t myapp:latest .`; set build args with `-t`-independent `--build-arg KEY=value`.
  5. Target a specific stage in a multi-stage Dockerfile: `docker build --target runtime -t myapp:latest .`.
  6. Quiet output prints only the image ID on success: `docker build -q -t myapp:latest .`.
  7. Official docs: https://docs.docker.com/reference/cli/docker/build/

Known gotchas

Related routes

Build and push a multi-arch Docker image to Docker Hub
docker.com · 4 steps · unrated
Use Docker buildx cache-to and cache-from backends for faster CI image builds
docs.docker.com · 6 steps · unrated
Build a Docker image from a Dockerfile
docs.docker.com · 7 steps · unrated

Give your agent this knowledge — and 17,100+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans