Skip to content

Docker: Docker Compose v2

7 Docker commands: Docker Compose v2. Click a command to see what each part does.

Index
7 items
Click a command to see what each part does.

Docker Compose v27

  • docker compose up -d --buildBuild and start everything in the background

    What each part does

    1. docker composeCompose v2 (plugin; not the old docker-compose binary)
    2. upcreate and start the services
    3. -ddetached
    4. --buildbuild images before starting
  • docker compose up -d --force-recreate --remove-orphans --waitRecreate cleanly and wait until healthy

    What each part does

    1. --force-recreaterecreate containers even if nothing changed
    2. --remove-orphansremove containers for services no longer in the file
    3. --waitwait until services are running/healthy (implies -d)
  • docker compose logs -f --tail 100 <service>Follow logs of one service

    What each part does

    1. logs <service>logs of that service (omit for all)
    2. -ffollow
    3. --tail 100start from the last 100 lines
  • docker compose exec <service> sh; docker compose run --rm <service> <cmd>Shell into a service / run a one-off task

    What each part does

    1. exec <service> shshell in the already-running service container
    2. run --rm <service> <cmd>start a new temporary container for a one-off command, removed afterwards
  • docker compose -f compose.yaml -f compose.prod.yaml -p <project> up -dUse several compose files and a project name

    What each part does

    1. -f compose.yaml -f compose.prod.yamlmerge files in order; later files override earlier ones
    2. -p <project>project name (prefix for container/network names)
  • docker compose configSee the final merged config

    What each part does

    1. configparse, merge and print the effective compose file (great for checking env substitution)
  • docker compose down -vStop and remove the stack (and its volumes)Destructive

    What each part does

    1. downstop and remove containers and networks
    2. -valso remove named volumes declared in the file: deletes data

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…