DOCKER-COMPOSE-BUILD(1)

πŸ“¦ version 2.26.1, in debian trixie

πŸ’… docker-compose-build β€” bestie edition πŸ’…

okay so you wanna know about docker-compose-build? it's the one that builds or rebuilds your services and honestly? it's giving main character energy. let's get into it 🫢


✨ SYNOPSIS ✨

docker compose build [OPTIONS] [SERVICE...]

that's it. that's the whole vibe. you point it at some services (or don't, and it does all of them, iykyk) and it goes to work πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” services get built once, and then they get tagged. by default that tag is project-service. periodt.

but wait, if your Compose file specifies an image name (like, the actual spec one over at https://github.com/compose-spec/compose-spec/blob/master/spec.md#image), then the image gets tagged with that name instead, and any variables get substituted beforehand. variable interpolation deets live here: https://github.com/compose-spec/compose-spec/blob/master/spec.md#interpolation ✨

and like, if you go and change a service's Dockerfile, or literally anything in its build directory? you gotta run docker compose build again to rebuild it. no shortcuts bestie, it won't notice on its own 😭


πŸ‘‘ OPTIONS πŸ‘‘

  • --build-arg=[] β€” set build-time variables for services πŸ’–
  • --builder="" β€” pick which builder to use
  • -h, --help[=false] β€” the help for build. classic.
  • -m, --memory=0 β€” set a memory limit for the build container. ⚠️ heads up: not supported by BuildKit. ngl that one matters.
  • --no-cache[=false] β€” do NOT use the cache when building the image. fresh start energy 🌸
  • --pull[=false] β€” always attempt to pull a newer version of the image. gotta stay current ✨
  • --push[=false] β€” push service images πŸš€
  • -q, --quiet[=false] β€” don't print anything to STDOUT. silent but deadly πŸ’€
  • --ssh="" β€” set SSH authentications used when building service images. (use 'default' for using your default SSH Agent) πŸ”‘
  • --with-dependencies[=false] β€” also build dependencies, transitively. bring the whole friend group 🫢

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

  • --dry-run[=false] β€” execute command in dry run mode. it's giving ✨rehearsal✨, nothing actually happens.

🌸 SEE ALSO 🌸


k that's the whole page bestie, go build something iconic πŸŽ€

mwah πŸ’‹ β€” this was the DOCKER-COMPOSE-BUILD(1) manual page, Mar 2025 edition, straight from the docker-compose-build source. slay responsibly.

πŸ“¦ where this page comes from