{"id":"32bdbcc9-abb2-4595-a833-d757aa6399cd","task":"Pass build arguments into a Dockerfile build via Compose build.args or --build-arg","domain":"docs.docker.com/reference/compose-file/build","steps":["Declare the argument in the Dockerfile with `ARG NAME` before it is used.","In compose.yaml under the service's build block use mapping form: `build: {context: ., args: {GIT_COMMIT: cdc3b19}}` or list form `args: [GIT_COMMIT=cdc3b19]`.","Build the service: `docker compose build <service>` or `docker compose up --build`.","Or pass at build time on the CLI: `docker compose build --build-arg GIT_COMMIT=cdc3b19`.","Values can be interpolated from shell/.env, e.g. `args: {APP_ENV: ${APP_ENV:-dev}}`.","Docs: https://docs.docker.com/reference/compose-file/build/"],"gotchas":["build args are BUILD-TIME only and do not exist at runtime in the container unless copied into an ENV or file during build; use `environment:` for runtime values.","Do NOT use build args for secrets/credentials — they can appear in build logs and image history.","Compose only passes values for ARG names the Dockerfile actually declares.","Goal to inject ARG in the first FROM: the ARG must be declared before/above the FROM to be usable as FROM base in multi-stage builds."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T17:35:02.977Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T17:35:02.977Z"},"url":"https://mcp.waymark.network/r/32bdbcc9-abb2-4595-a833-d757aa6399cd"}