Skip to main content

Dagger Environment Variables Reference

Dagger supports a variety of environment variables.

They have two purposes:

  • Extend Dagger capabilities
  • Persist CLI options

Extend Dagger capabilities

Dagger aims to fit any use case, even the most specific ones. To avoid burdening the user experience with rarely used options, a small list of environment variables can be set:

Environment variableSourceDescription
BUILDKIT_HOSTcustom buildkitLink Dagger to custom Buildkit instance
DOCKER_HOSTcustom buildkit w/DockerLink Dagger to custom Buildkit instance running in Docker
OTEL_EXPORTER_JAEGER_ENDPOINTopentelemetryOpentelemetry Jaeger endpoint
JAEGER_TRACEopentelemetryJaeger UI endpoint
DOCKERHUB_AUTH_USERimage.cueDocker.#Pull repository login
DOCKERHUB_AUTH_PASSWORDimage.cueDocker.#Pull repository password

Persist CLI options

As Dagger relies on Viper to manage the CLI inputs, all its option can be replaced with environment variables:

dagger version

optionUsageDescription
--checkexport DAGGER_CHECK=1check if dagger is up to date

dagger project

init

optionUsageDescription
--nameexport DAGGER_NAME=stringproject name
--templateexport DAGGER_TEMPLATE=stringTemplate name [hello]

update

optionUsageDescription
--private-key-fileexport DAGGER_PRIVATE_KEY_FILE=stringPrivate ssh key
--private-key-passwordexport DAGGER_PRIVATE_KEY_PASSWORD=stringPrivate ssh key password
--updateexport DAGGER_UPDATE=1Update to latest version of specified packages

info

optionUsageDescription
--planexport DAGGER_PLAN=stringPath to plan (defaults to current directory) (default ".")

dagger do

optionUsageDescription
--cache-fromexport DAGGER_CACHE_FROM=stringExternal cache sources (eg. user/app:cache, type=local,src=path/to/dir)
--cache-toexport DAGGER_CACHE_TO=stringCache destinations (eg. user/app:cache, type=local,dest=path/to/dir)
--dry-runexport DAGGER_DRY_RUN=1Dry run mode
--no-cacheexport DAGGER_NO_CACHE=1Disable caching
--outputexport DAGGER_OUTPUT=stringFile path to write the action's output values. Prints to stdout if empty
--output-formatexport DAGGER_OUTPUT_FORMAT=stringFormat for output values (plain, json, yaml)
--planexport DAGGER_PLAN=stringPath to plan (defaults to current directory) (default ".")
--platformexport DAGGER_PLATFORM=stringSet target build platform (requires experimental)
--withexport DAGGER_WITH=stringSet value of dagger value at runtime