liveBook · Manning

Docker build

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

docker build is a Docker CLI command that constructs a Docker image from a build context and instructions.

docker build packages application code and assets into a ready-to-run Docker image by following instructions in a Dockerfile. Run it from the project directory and end the command with . so the current directory supplies the build context. section 3.8.2 section 3.12

Build a microservice image

cd chapter-3/example-1 docker build -t video-streaming --file Dockerfile . The command downloads uncached base-image layers, then reports the image ID and tag. Inspect the result with docker image list; the example produces a video-streaming:latest image. section 3.8.2

Use the command options to control the build:

  • -t assigns a meaningful image name and tag, avoiding reliance on the generated image ID. section 3.8.2
  • --file selects the Dockerfile used for the build. section 3.10
  • The final . supplies the current directory as the build context; omitting it is a common mistake. section 3.8.2 section 6.11.2
  • Use versioned tags such as video-streaming:1 for deployments, incrementing the number for later builds. section 6.8.1
Figure 3.19 A complete Docker build pipeline showing where build, push, and run fit within the process

Follow the complete pipeline from building an image through tagging, registry authentication, publishing, and running it. section 3.10

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Explains command syntax, build context, tagging, cached layers, output, and deployment-oriented versioning without detailing Dockerfile instructions.
Examples
Uses Node.js video-streaming projects, Dockerfile-prod builds, image listings, and versioned registry-publishing commands.
What it assumes
Assumes Docker, a project directory, and a Dockerfile; teaches the build command and image workflow from the available working example.
What you can do after
Build it from scratch, inspect the resulting image, assign deployment versions, and prepare it for registry publication.
How it connects
Connects Dockerfile, Docker image, build context, image tags, container registries, docker push, docker run, and Kubernetes.

Also explained in

Compare how 4 books explain docker build →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.