The output of each container is combined by the docker-compose up
command. The command stops all containers upon execution. The containers are started and kept operating in the background by using docker-compose up -d
.
"Docker-compose up" picks up the changes by halting and creating new containers for any services that already have containers and whose configuration or image has changed after the containers were created (preserving mounted volumes). Use the —no-recreate
flag to stop Compose from detecting modifications.
Use the —force-recreate
flag to compel Compose to stop and recreate all containers.
$ docker compose up [OPTIONS] [SERVICE...]
Here,
OPTIONS:
-d
→ Detached mode: Run containers in the background, and print new container names.—no-color
→ Produce monochrome output.—no-deps
→ Don't start linked services.—force-recreate
→ Recreate containers even if their configuration and image haven't changed.—no-recreate
→ If containers already exist, don't recreate them.—no-build
→ Don't build an image, even if it's missing.—build
→ Build images before starting containers.—abort-on-container-exit
→ Stops all containers if any container was stopped. Incompatible with -d.—timeout
or -t
→ TIMEOUT Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)—remove-orphans
→ Remove containers for services not defined in the Compose file