Koskamo

Building images with Compose

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

Build is an optional part of the Compose Specification; it defines how to (re)build an application from source portably. build can be a single string defining a context path or a detailed build definition. As a string, the whole path is the Docker context for a Docker build, looking for a canonical Dockerfile at the directory's root; as a detailed structure, build arguments and an alternate Dockerfile location can be specified. Paths can be absolute or relative; relative paths resolve from the Compose file's directory, while absolute paths prevent portability, so Compose displays a warning. When both build and image are set, Compose follows the pull_policy attribute; without pull_policy, it pulls the image first, then builds from source if not found. Scope: Docker Compose. Reviewed October 4, 2026.

Source and provenance

Original source
docs.docker.com
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.