Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

dockerfile

Configuration of a dockerfile resource built locally before being run.

The runtime performs a docker build in context, then starts the resulting image as it would for a [crate::ContainerConfig].

FieldTypeRequiredDefaultDescription
build_argsmap of stringnoBuild-time ARG values passed to docker build --build-arg.
commandCommandnoOptional override for the image default CMD. The image ENTRYPOINT is preserved. See [Command] for the accepted forms and for what this means against an image whose entrypoint is a binary rather than a shell.
contextstringyesBuild context path, relative to the manifest file. Resolved to an absolute path by [crate::Manifest::resolve_host_volume_paths] before it is handed to the runtime.
depends_onarray of stringnoNames of other resources this build must wait for before starting. Validated by [crate::Manifest::validate].
dockerfilestringno"Dockerfile"Path to the Dockerfile within context. Defaults to "Dockerfile".
entrypointCommandnoOptional override for the image ENTRYPOINT, the executable the container runs. See [Command] for the accepted forms. Setting this discards the image CMD: every target (the Engine API, Compose and Kubernetes) ignores the image default command once an entrypoint is overridden. Set command as well to supply arguments. An empty list or a blank string is rejected; omit the field to keep the image entrypoint.
envmap of stringnoEnvironment variables injected into the container at runtime. Values support ${env.NAME} and ${resources.name.property} interpolation.
healthcheckHealthchecknoOptional healthcheck override. See [Healthcheck] for field semantics.
portsarray of PortMappingnoPort mappings between the host and the container. See [PortMapping].
secretsmap of stringnoSensitive environment variables injected at runtime. Exporters preserve each key but replace its value with a placeholder, preventing credentials from being baked into generated artifacts.
targetstringnoMulti-stage build target passed to docker build --target.
volumesarray of stringnoVolume mappings in "host:container" or "named:container" form. Relative host paths are resolved by [crate::Manifest::resolve_host_volume_paths].
working_dirstringnoOptional working directory override inside the container.