EXAMPLE
Devcontainer
This example demonstrates how to configure [devcontainers](https://atmos.tools/cli/configuration/devcontainer) in Atmos as a replacement for the Geodesic shell wrapper.
Try it out
- Install Atmos
- Try the example
Copy the example into a new directory and make it your own:
atmos init examples/devcontainer
cd devcontainer
Follow the README for prerequisites and next steps.
See it in action
RECORDED DEMO Real commands. Real output.
README.md3.0 KB
View on GitHubDevcontainer Example
This example demonstrates how to configure devcontainers in Atmos as a replacement for the Geodesic shell wrapper.
Files
devcontainer.json- Geodesic devcontainer configuration (VS Code compatible)atmos.yaml- Atmos configuration with multiple devcontainer definitions
Usage
Using the Default Geodesic Devcontainer
# Create and attach to the default devcontainer (Geodesic)atmos devcontainer start default --attach# Inside the containerterraform planatmos terraform apply vpc -s ue2-dev
Using Named Devcontainers
# Create Terraform-specific devcontaineratmos devcontainer start terraform --attach# Create Python devcontaineratmos devcontainer start python --attach
Using Multiple Instances
# Create multiple instances of the same devcontaineratmos devcontainer start default --instance alice --attachatmos devcontainer start default --instance bob --attach# List all running devcontainersatmos devcontainer list
Configuration Methods
Method 1: Import existing devcontainer.json
devcontainers:default: !include devcontainer.json
This imports the VS Code-compatible devcontainer.json file. Unsupported fields (like features, customizations, postCreateCommand) are silently ignored and logged at debug level.
Method 2: Define inline in atmos.yaml
devcontainers:terraform:name: "Terraform Dev"image: "hashicorp/terraform:1.6"forwardPorts: [8080, 3000]# ... more configuration
Method 3: Merge imported config with overrides
devcontainers:custom:<<: !include devcontainer.json# Override specific fieldsforwardPorts: [9000, 9001]
Port Forwarding Examples
Simple Port Mapping
forwardPorts:- 8080 # Maps 8080:8080- 3000 # Maps 3000:3000
Explicit Port Mapping
forwardPorts:- "8080:8080" # Explicit host:container- "3001:3000" # Map host 3001 to container 3000
With Port Attributes
forwardPorts:- 8080portsAttributes:"8080":label: "Web Server"protocol: "http"
Commands
# Start and attach to devcontaineratmos devcontainer start <name> --attach# Start devcontainer without attachingatmos devcontainer start <name># Stop running containeratmos devcontainer stop <name># Attach to running containeratmos devcontainer attach <name># Execute command in containeratmos devcontainer exec <name> -- terraform plan# List containersatmos devcontainer list# Remove containeratmos devcontainer remove <name># Show configurationatmos devcontainer config <name>