DOCKER-COMPOSE-BUILD(1)
π 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 toSTDOUT. 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
- debian trixie: docker-compose 2.26.1-4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms