Development Containers
Configure development container environments in your atmos.yaml to provide consistent, reproducible tooling across your team. Based on the Development Container Specification, Atmos manages named container configurations with support for Docker and Podman runtimes.
Quick Start
The simplest devcontainer configuration uses a pre-built image:
atmos.yaml
Launch it with:
atmos devcontainer shell terraform
Configuration Structure
Development containers are configured under the top-level devcontainer key. Each entry is a named configuration that can be launched independently:
atmos.yaml
Settings
Atmos-specific configuration options that control how containers are managed.
settings.runtimeSpecify the container runtime to use:
"docker","podman", or omit for automatic detection.Default: Auto-detect (checks Docker first, then Podman)
When omitted, Atmos will automatically detect which runtime is available on your system. This is useful for teams where some members use Docker and others use Podman.
Example:
devcontainer:
geodesic:
settings:
runtime: "podman"
spec:
image: "cloudposse/geodesic:latest"
Spec (Development Container Specification)
The spec section follows the Development Container Specification. You can provide either a single map or a list of maps (for merging configurations).
Basic Configuration
spec.nameDisplay name for the container.
Type: string
Example:
spec:
name: "Terraform Development Environment"spec.imagePre-built container image to use. Use this or
build, not both.Type: string
Example:
spec:
image: "hashicorp/terraform:1.10"spec.buildBuild configuration for creating a custom container. Use this or
image, not both.Type: object with fields:
dockerfile(string) - Path to Dockerfilecontext(string) - Build context directoryargs(map) - Build arguments
Example:
spec:
build:
dockerfile: ".devcontainer/Dockerfile"
context: "."
args:
NODE_VERSION: "20"
PYTHON_VERSION: "3.12"
Workspace Configuration
spec.workspaceFolderWorking directory inside the container where commands will execute.
Type: string Default:
/workspaceExample:
spec:
workspaceFolder: "/workspace"spec.workspaceMountPrimary workspace volume mount specification. Uses Docker mount syntax.
Type: string
Supports variable expansion:
${localWorkspaceFolder}- Path to the workspace on your machine${localEnv:VAR}- Local environment variable
Example:
spec:
workspaceMount: "type=bind,source=${localWorkspaceFolder},target=/workspace"spec.mountsAdditional volume mounts beyond the workspace. Common uses include mounting credential directories or SSH keys.
Type: array of strings (Docker mount syntax)
Example:
spec:
mounts:
- "type=bind,source=${localEnv:HOME}/.aws,target=/root/.aws,readonly"
- "type=bind,source=${localEnv:HOME}/.ssh,target=/root/.ssh,readonly"
- "type=volume,source=terraform-cache,target=/root/.terraform.d/plugin-cache"
Port Configuration
spec.forwardPortsPorts to forward from the container to your host machine. Supports both static ports and the
!randomYAML function for dynamic port assignment.Type: array of numbers or strings
Example:
spec:
forwardPorts:
- 3000 # Static port
- !random 8080 8099 # Random port in range (avoids conflicts)
- "8080:8081" # Host 8080 to container 8081Using
!randomis recommended when running multiple instances to avoid port conflicts.spec.portsAttributesMetadata for forwarded ports, such as labels and protocols.
Type: object mapping port numbers/strings to attribute objects
Each port can have:
label(string) - Descriptive labelprotocol(string) - Protocol (http, https, etc.)
Example:
spec:
portsAttributes:
"3000":
label: "Web Server"
protocol: "http"
"5432":
label: "PostgreSQL"
protocol: "tcp"
Environment Configuration
spec.containerEnvEnvironment variables to set inside the container.
Type: object (key-value pairs)
Supports variable expansion:
${localEnv:VAR}- Expand from your local environment${localWorkspaceFolder}- Path to workspace
Example:
spec:
containerEnv:
AWS_PROFILE: "${localEnv:AWS_PROFILE}"
TF_PLUGIN_CACHE_DIR: "/root/.terraform.d/plugin-cache"
TERM: "${localEnv:TERM}"spec.remoteUserUser to run as inside the container.
Type: string Default: Depends on the image
Example:
spec:
remoteUser: "root"
Runtime Configuration
spec.runArgsAdditional arguments to pass to
docker runorpodman run.Type: array of strings
Example:
spec:
runArgs:
- "--network=host"
- "--dns=8.8.8.8"spec.overrideCommandWhether to override the image's ENTRYPOINT/CMD.
Type: boolean Default:
falseExample:
spec:
overrideCommand: truespec.initRun an init process inside the container to handle signal forwarding and reaping.
Type: boolean Default:
falseExample:
spec:
init: truespec.privilegedRun the container in privileged mode.
Type: boolean Default:
falseWarning: Only use when necessary for your workflow.
Example:
spec:
privileged: truespec.capAddLinux capabilities to add to the container.
Type: array of strings
Example:
spec:
capAdd:
- "SYS_PTRACE"
- "NET_ADMIN"spec.securityOptSecurity options for the container.
Type: array of strings
Example:
spec:
securityOpt:
- "seccomp=unconfined"spec.userEnvProbeHow to probe the user environment inside the container.
Type: string Options:
"none","loginShell","loginInteractiveShell","interactiveShell"Example:
spec:
userEnvProbe: "loginInteractiveShell"
Advanced Features
Merging Configurations with !include
Reuse existing .devcontainer/devcontainer.json files by merging them with Atmos-specific overrides:
atmos.yaml
When using a list, configurations are merged in order. Later entries override earlier ones.
Dynamic Port Assignment
Use the !random YAML function to avoid port conflicts when running multiple container instances:
atmos.yaml
This is especially useful when launching multiple instances with the --instance flag.
Multiple Instances
Run multiple containers from the same configuration using the --instance flag:
# Default instance
atmos devcontainer shell geodesic
# Named instances
atmos devcontainer shell geodesic --instance dev
atmos devcontainer shell geodesic --instance prod
atmos devcontainer shell geodesic --instance testing
Each instance gets a unique container name: atmos-<config>-<instance>.
Common Patterns
Pattern: Simple Image-Based Container
Use a pre-built image for quick development environments:
atmos.yaml
Pattern: Custom Dockerfile Build
Build a custom container with specific tools:
atmos.yaml
Pattern: Geodesic Shell (Multi-Tool Environment)
Use Geodesic as a comprehensive toolbox:
atmos.yaml
Pattern: Mounting Authentication Credentials
Mount cloud provider credentials into your container:
atmos.yaml
Alternatively, use Atmos identity injection with the --identity flag for enhanced security.
Complete Example
A comprehensive configuration showing all major features:
atmos.yaml
Environment Variables
The devcontainer configuration is read exclusively from atmos.yaml and does not support environment variable overrides. However, individual container settings support environment variable expansion using ${localEnv:VAR} syntax within the spec section.
Related Commands
📄️ atmos devcontainer
Development container management
📄️ atmos devcontainer shell
Launch interactive shell in container
📄️ atmos devcontainer start
Start a devcontainer
📄️ atmos devcontainer attach
Attach to running container
📄️ atmos devcontainer exec
Execute command in container
📄️ atmos devcontainer stop
Stop a devcontainer
📄️ atmos devcontainer logs
View container logs
📄️ atmos devcontainer remove
Remove a devcontainer
📄️ atmos devcontainer rebuild
Rebuild a devcontainer
📄️ atmos devcontainer list
List devcontainers
See Also
- CLI Configuration — Overview of Atmos CLI configuration
- Development Container Specification — Complete specification reference
- YAML Functions — Including
!includeand!random - Auth Configuration — Configure identity injection with
--identityflag