docker compose up --build is a Docker Compose command invocation that rebuilds service images before creating and starting the services.
docker compose up --build boots a Compose application while rebuilding each service image before creating and starting its containers. Run it from the directory containing the Docker Compose file. section 4.3.3section 4.8
Start the application with fresh images
cd chapter-4/example-1
docker compose up --build
The command downloads required base-image layers when needed, starts the service, and displays its container output, such as “Microservice online.” section 4.3.3
Use the flag deliberately during development:
Use --build after changing microservice code so the running application includes those changes. section 4.3.3
Omit --build when you only need to restart containers from an existing image and do not need a rebuild. section 4.3.3
Pair the command with docker compose down when rebooting the application or replacing updated code and dependencies. section 4.3.5
cd chapter-4/example-1
docker compose up --build
Run the copyable command from the Compose project directory. section 4.3.3
How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it
How deep it goes
Explains image rebuilding, container instantiation, stale-code risk, and reboot workflow without detailing image-build internals.
Examples
Uses a video-streaming microservice, chapter-4/example-1, terminal output, and an up.sh or reboot.sh wrapper.
What it assumes
Assumes a Docker Compose file and project directory, while teaching why rebuilding prevents testing stale application code.
What you can do after
Operate Docker Compose to rebuild images, start services, verify output, and reboot an application with updated code or dependencies.
How it connects
Connects Docker Compose with Dockerfiles, containers, microservices, Docker Compose down, and shell scripts.
distributed systemproduces · A distributed system is a computing system whose components run across multiple networked processes or machines and coordinate through communication.
docker compose upconfigures · docker compose up is a Docker Compose command that creates and starts the services declared in a Compose configuration.
Docker Composeused by · Docker Compose is a tool for defining and running applications composed of multiple containers through declarative configuration.
shell scriptused by · Bash is a Unix command-line shell and scripting language for executing commands interactively and through scripts.
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.