mcpField
D
devcontainers

devcontainers

github.com/digitalocean-labsDevelopment3883 installsUpdated 4d ago
Repository

About devcontainers

This skill sets up local development containers for DigitalOcean App Platform applications. It helps developers map application services to Compose profiles and supports IDE-based and CLI-only workflows.

Key features

  1. 01Copy and configure a devcontainer for a new project
  2. 02Map App Platform services to local profiles
  3. 03Provide profiles for seven backing services
  4. 04Generate local environment variable mappings
  5. 05Run service connectivity tests

Use cases

  1. 01Set up a local environment with databases for a new app
  2. 02Run an existing App Platform application locally
  3. 03Test container services without an IDE

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/digitalocean-labs/do-app-platform-skills --skill devcontainers

After installing, type/devcontainersin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
reference/
agent-verification.md
cli-workflow.md
language-configurations.md
s3-storage-patterns.md
service-templates.md

Details

From the project README

Dev Containers Skill

Set up local development environments with production parity for DigitalOcean App Platform applications.

Primary value: 30-second feedback loops instead of 7-minute deploy cycles.

Quick Decision

What do you need?
├── New project setup → Workflow 1
├── Existing App Platform app → Workflow 2
└── CLI-only testing (no IDE) → See cli-workflow.md

Quick Start: Clone and Copy

# Clone the reference devcontainer
git clone --depth 1 https://github.com/bikramkgupta/do-app-devcontainer.git /tmp/devcontainer-ref

# Copy to your project
cp -r /tmp/devcontainer-ref/.devcontainer /path/to/your-project/

# Clean up
rm -rf /tmp/devcontainer-ref

Then customize COMPOSE_PROFILES in .devcontainer/devcontainer.json:

"containerEnv": {
  "COMPOSE_PROFILES": "app,postgres,minio"
}

Available Profiles

ProfileServiceUse When
postgresPostgreSQL 18SQL database
mysqlMySQL 8MySQL database
mongoMongoDB 8Document database
valkeyValkey 8Redis-compatible cache
kafkaConfluent Kafka 7.7Message streaming
minioRustFSS3-compatible storage
opensearchOpenSearch 3.0Full-text search

Connection Strings

ServiceConnection String
PostgreSQLpostgresql://postgres:password@postgres:5432/app
MySQLmysql://mysql:mysql@mysql:3306/app
MongoDBmongodb://mongodb:mongodb@mongo:27017/app?authSource=admin
Valkeyredis://valkey:6379
Kafkakafka:9092
RustFShttp://minio:9000 (creds: rustfsadmin/rustfsadmin)
OpenSearchhttp://opensearch:9200

Inside container: Use service names (e.g., postgres:5432) From host: Use docker compose port to find mapped ports


Workflow 1: New Project Setup

Trigger: "I'm building a [language] app with [services]"

  1. Copy .devcontainer/ from reference repo (see Quick Start)
  2. Set COMPOSE_PROFILES based on required services
  3. Create env-devcontainer.example with connection strings
  4. Open in VS Code/Cursor → "Reopen in Container"

devcontainer.json template:

{
  "name": "App Platform Dev Environment",
  "dockerComposeFile": "docker-compose.yml",
  "service": "app",
  "workspaceFolder": "/workspaces/app",
  "features": {
    "ghcr.io/devcontainers/features/github-cli:1": {},
    "ghcr.io/devcontainers/features/node:1": {},
    "ghcr.io/devcontainers/features/python:1": {},
    "ghcr.io/devcontainers-extra/features/uv:1": {},
    "ghcr.io/devcontainers-extra/features/digitalocean-cli:1": {},
    "ghcr.io/anthropics/devcontainer-features/claude-code:1": {},
    "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
  },
  "containerEnv": {
    "COMPOSE_PROFILES": "app,postgres"
  },
  "initializeCommand": "cd \"${localWorkspaceFolder}\" && bash .devcontainer/init.sh",
  "postCreateCommand": ".devcontainer/post-create.sh",
  "remoteUser": "vscode",
  "shutdownAction": "stopCompose"
}

Workflow 2: Add to Existing App Platform App

Trigger: "I have an App Platform app, help me run it locally"

  1. Read .do/app.yaml to detect services
  2. Map App Platform → local containers:
App PlatformLocal Profile
databases[].engine: PGpostgres
databases[].engine: MYSQLmysql
databases[].engine: MONGODBmongo
databases[].engine: REDISvalkey
Spaces attachmentminio
  1. Generate environment mapping:
# Production (App Platform injects)
# DATABASE_URL=${db.DATABASE_URL}

# Local Development
DATABASE_URL=postgresql://postgres:password@postgres:5432/app

Environment Template

# env-devcontainer.example

# Database
DATABASE_URL=postgresql://postgres:password@postgres:5432/app

# Cache
REDIS_URL=redis://valkey:6379

# S3-compatible storage (RustFS)
SPACES_ENDPOINT=http://minio:9000
SPACES_KEY_ID=rustfsadmin
SPACES_SECRET_KEY=rustfsadmin
SPACES_BUCKET_NAME=my-app-local
SPACES_FORCE_PATH_STYLE=true

What You Get from Reference Repo

.devcontainer/
├── devcontainer.json           # IDE configuration
├── docker-compose.yml          # All 7 backing services
├── init.sh                     # Git worktree support
├── post-create.sh              # Post-creation setup
├── .env                        # Generated (gitignored)
└── tests/                      # Service connectivity tests
    ├── agent-test.sh           # E2E validation
    ├── run-all-tests.sh        # Master test runner
    └── test-*.sh               # Individual service tests

Testing Services

# Test all running services
.devcontainer/tests/run-all-tests.sh --all

# Test specific services
.devcontainer/tests/run-all-tests.sh postgres minio

# List available tests
.devcontainer/tests/run-all-tests.sh --list

Health Check Timing

ServiceReady Time
PostgreSQL, MySQL, MongoDB, Valkey, RustFS<10s
Kafka60s+ (KRaft init)
OpenSearch30-60s (JVM warmup)

Quick Troubleshooting

IssueFix
Port conflictConfig uses dynamic ports (127.0.0.1:0:PORT), should not conflict
Git commands failRebuild container to re-run init.sh
Kafka slow to startWait 60s+, check: docker compose logs kafka
OpenSearch OOMIncrease heap: OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g
Permission deniedRun: sudo chown -R vscode:vscode /home/vscode

Reference Files

FileContent
service-templates.mdAll 7 docker-compose service blocks
s3-storage-patterns.mdRustFS setup, local vs production
agent-verification.mdCLI testing workflow for AI agents
cli-workflow.mdPort forwarding, env loading, startup
language-configurations.mdNode, Python, Go hot reload configs

Limitations

This skill does not handle:

  • Cloud deployment → use deployment skill
  • Production app specs → use designer skill
  • Database migrations → bring your own migration tool
  • DigitalOcean Functions → not containerizable
  • SSL/TLS → local uses HTTP; production handles SSL automatically

Integration with Other Skills

  • → designer: Design production app spec after local testing
  • → deployment: Set up GitHub Actions CI/CD
  • → postgres: Configure managed database permissions
  • → troubleshooting: Debug production issues

External References

Comments

Markdown supported