Skip to main content
lager devenv manages a reproducible, Docker-based development environment for a project. It records the image, mount directory, shell, saved commands, bind mounts, and environment variables in the DEVENV section of your project’s .lager config file, so every engineer (and your CI) builds and tests in the same container. The environment is consumed by lager exec (run a command in the container) and lager devenv terminal (open an interactive shell in the container).

Syntax

Subcommands

Prerequisites

Docker must be installed and on your PATH. Install it from docker.com. On Linux, add your user to the docker group so you don’t need sudo:

create

Create the DEVENV section in your project’s .lager config. Run this once per project before using lager exec or lager devenv terminal.
The image name is validated against standard Docker naming (name, name:tag, registry/name, registry/name:tag). For lagerdata/* images the shell defaults to /bin/bash; for other images you’ll be prompted. If a DEVENV section already exists you’ll be asked before overwriting it.

terminal

Open an interactive shell inside the development container. Your project directory is bind-mounted at the configured mount_dir, and the container is removed on exit (unless --detach is used).
CLI flags take precedence over the matching keys stored in the DEVENV config; config-defined ports, volumes, and environment are applied first, then anything passed on the command line is appended. terminal also wires up SSH for you automatically: it forwards your SSH_AUTH_SOCK agent socket and mounts ~/.ssh/id_ed25519 and ~/.ssh/known_hosts (read-only) when they exist, and it mounts your global .lager config into the container so nested lager calls are authenticated. Use --info to debug what would run without launching anything:

Attach to a running container


show

Print the resolved DEVENV configuration — scalar keys, list keys (ports, volumes, environment), and saved commands.

set / unset

Set or remove individual configuration keys without re-running create.
Scalar keys (replaced on set): image, mount_dir, shell, user, group, entrypoint, hostname, macaddr, network, platform, repo_root_relative_path. The ports key is a list and is appended to (the singular alias port is accepted). Edit volumes and environment with lager devenv mount and lager devenv env respectively — set will refuse them and point you at the right command.

Saved commands: add / delete / commands

Save shell commands under a name so they can be run with lager exec <name>. Commands are stored as cmd.<name> keys in the DEVENV section.
Command names may contain only letters, numbers, dashes, and underscores. If you omit the command string, add prompts for it. By default add warns when overwriting an existing command; pass --no-warn to suppress that.

Persistent bind-mounts: mount

Persist host bind-mounts / named volumes in the config so they’re applied on every lager devenv terminal and lager exec run.
Specs use Docker -v form: HOST:CONTAINER[:ro] for a bind-mount or NAME:CONTAINER for a named volume. For portability across machines, specs may use ~, environment variables, and ${PROJECT_ROOT} (which expands to your project’s .lager directory).

Persistent environment variables: env

Persist environment variables in the config so they’re set on every run.
env set replaces any existing value for the same variable.

How it relates to lager exec

All three read the same DEVENV section, so a command saved with lager devenv add is runnable with lager exec, and a mount added with lager devenv mount add applies to both terminal and exec.

Notes

  • Configuration is stored in the DEVENV section of the nearest .lager config file, discovered by walking up from the current directory.
  • terminal launches the container with --rm by default, so it’s removed on exit unless you pass --detach.
  • Exit codes from the container are propagated to the CLI.