Back to Dagger

Environments

docs/versioned_docs/version-1.0-beta/using-dagger/environments.mdx

0.21.51.3 KB
Original Source

Environments

An environment is a named overlay on top of your workspace configuration. Use environments when the same checks, generators, or services need different settings in different contexts — for example a different base image in staging than in production.

Create an environment

shell
dagger env create staging

List environments

shell
dagger env list

Remove an environment

shell
dagger env rm staging

Apply an environment

Pass --env to any command to apply an overlay for that run:

shell
dagger --env staging check
dagger --env staging call deploy

Configure an environment

Most per-environment differences are module settings — a base image, a package manager. Set them with dagger settings and --env, which targets that environment's overlay instead of the base configuration:

shell
dagger settings --env staging eslint baseImageAddress node:22-alpine

Reads with --env show the effective view — the base settings with the overlay applied:

shell
dagger settings --env staging eslint

Without --env, you read and write the base configuration, which every environment inherits.

For configuration that isn't a module setting, dagger config is the lower-level key/value interface to .dagger/config.toml and follows the same --env overlay rules.