docs/current_docs/cookbook/containers.mdx
import PublishPrivateRegistry from "@cookbookContainer/_publish-private-registry.mdx"; import PublishPrivateRegistryMultiple from "@cookbookContainer/_publish-private-registry-multiple.mdx"; import ExportContainerImageToHost from "@cookbookContainer/_export-container-image-to-host.mdx"; import SetEnvVar from "@cookbookContainer/_set-env-var.mdx";
Dagger allows you to build, publish, and export container images, also known as just-in-time artifacts, as part of your Dagger Functions. This section shows you how to work with container images using Dagger with practical examples.
<PublishPrivateRegistry /> <PublishPrivateRegistryMultiple /> <ExportContainerImageToHost /> <SetEnvVar />withVolatileVariable sets a non-secret environment variable for future withExec calls without invalidating exec cache when only the variable's value changes.
Typical examples include CI and reporting metadata such as:
:::warning
withVolatileVariable is an expert-only escape hatch. Use it only when you are certain that changing the variable alone must not invalidate cached withExec results. If that assumption is wrong, Dagger may reuse stale or incorrect cached results.
:::
Unlike withEnvVariable, volatile variables:
withExec callsenvVariable or envVariablesexpand: trueUse withEnvVariable for normal container configuration, withSecretVariable for sensitive values, and withVolatileVariable only for exec-time metadata that should not decide cache reuse.