← Docker: run and diagnose containers
07 / 12 · 60 MIN

Compose: inputs and effective model

Reconstruct configuration from its inputs, distinguishing interpolation, service environment and behavior actually observed.

YAML is one part of the inputs

A release review needs executor version, selected files, override order and external interpolation values. The same YAML may produce different image references. In the original lab, inputs.env defines DR_TAG=file-tag, but a process variable containing shell-tag wins when supplied. The resolved image changes without editing the Compose file. To investigate a laptop versus pipeline difference, start with these inputs and the canonical model, preserving the identity of the artifact actually reviewed before application. This makes the configuration decision reproducible within its stated scope.

Empty and absent have different effects

The experiment sets DR_EMPTY to an empty string. The expression using:- produces fallback, while the form using - retains empty. This distinction matters when empty disables an option or absence should select a default. Avoid fixing failure by removing a constraint without reviewing the application contract. For required inputs, the lab uses:? and observes rejection before model generation. The pipeline should treat that result as a missing precondition rather than silently falling back to an older configuration from a different attempt.

Interpolation and service environment

A variable available for constructing the model is not automatically forwarded to the container process. DR_UNUSED exists in the synthetic interpolation file but is absent from the service environment because it was not declared for that purpose. In another experiment, service.env supplies DR_MODE and DR_EMPTY, but environment replaces both, including an explicitly empty value. Review interpolation inputs separately from application inputs. The lab observes the resulting structure; it started no container to inspect runtime environment and read no private user variables while creating that evidence.

Evaluation order may block an override

In the required-input experiment, the base file uses DR_REQUIRED in the image and the override supplies a literal reference. Nevertheless, absence of the variable causes failure. Per-file interpolation happens before merging, so the later reference does not bypass the base expression. If a team wants to remove that dependency, it should review file structure or supply an authorized input instead of assuming the last field removes all earlier evaluation. Retain the actual error in the report to distinguish this situation from a registry failure.

Escapes and output need careful reading

The command case using printf and $$DR_TAG retains escaping in canonical JSON. No process starts, so there is no evidence of shell expansion or a value received by the application. Command form needs to match execution intent. Also review where config output goes: it may contain resolved values that should not be published in a ticket. Every value in this experiment is fictional and the runner uses an empty Docker configuration. In a real environment, preserve useful evidence with appropriate access and disclosure controls.

Reproduction workshop without confusing validations

Prepare a record containing Compose 2.40.3-desktop.1, files in order, fictional inputs and expected results. The runner executed config with a nonexistent Unix socket and obtained valid models, demonstrating that this test requires no running service. It does not claim an image exists, a volume is available or a consumer works. For a fictional funds change, use the model as an initial gate and later add authorized runtime and acceptance checks. Communicate: “The configuration model passed; runtime and consumer validation remain outstanding.”

IN PRACTICE

inputs.env selects file-tag; a process variable selects shell-tag. With empty DR_EMPTY,:- selects fallback and - retains empty. The experiment observes CLI JSON without containers.

Common pitfalls

Treating --env-file as automatic container injection; confusing empty with absent; assuming an override bypasses all earlier interpolation; using config as availability evidence.

Related topics: Build and distribution · Data and mounts · Diagnosis and recovery

Take this idea with you

Record the inputs producing the model and the test scope. Resolved configuration is a verifiable stage, but still needs application and acceptance in the correct context.

Create account

Reference: Set, use, and manage variables in a Compose file with interpolation · Docker Engine Linux containers, BuildKit and Compose; official documentation consulted 2026-09-30; version-dependent behavior explicitly scoped

Docker® is a registered trademark of Docker, Inc. bigsavant.com is an independent preparation platform and is not affiliated with, associated with, sponsored, authorised or endorsed by Docker. Content and questions are original, are not official exam questions, and completing our tests does not award or guarantee any certification. Names are used only to identify the subject. All other trademarks belong to their respective owners.