setup-docker-compose
About
This skill configures Docker Compose for multi-container R development environments, handling service definitions, volume mounts, networking, and environment variables. It enables running R alongside other services like databases and APIs while ensuring reproducible environments. Use it to orchestrate R-based applications and manage project-specific configurations for both development and production.
Quick Install
Claude Code
Recommendednpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/setup-docker-composeCopy and paste this command in Claude Code to install this skill
Documentation
Set Up Docker Compose
Configure Docker Compose for R dev + deploy envs.
Use When
- R + other services (DBs, APIs)
- Reproducible dev env
- Orchestrate R-based MCP server
- Manage env vars + volume mounts
In
- Required: Dockerfile for R service
- Required: Project dir to mount
- Optional: Additional services (DB, cache, web)
- Optional: Env var config
Do
Step 1: Create docker-compose.yml
version: '3.8'
services:
r-dev:
build:
context: .
dockerfile: Dockerfile
container_name: r-dev
image: r-dev:latest
volumes:
- .:/workspace
- renv-cache:/workspace/renv/cache
stdin_open: true
tty: true
environment:
- TERM=xterm-256color
- R_LIBS_USER=/workspace/renv/library
- RENV_PATHS_CACHE=/workspace/renv/cache
command: R
restart: unless-stopped
volumes:
renv-cache:
driver: local
→ docker-compose.yml exists w/ R service, volume mounts (project + renv cache), env vars for R lib paths.
If err: invalid YAML → docker compose config validate. Spaces (not tabs); special chars quoted.
Step 2: Add Services (If Needed)
services:
r-dev:
# ... as above
depends_on:
- postgres
environment:
- DB_HOST=postgres
- DB_PORT=5432
postgres:
image: postgres:16
container_name: r-postgres
environment:
POSTGRES_DB: analysis
POSTGRES_USER: ruser
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
renv-cache:
pgdata:
→ Service (PostgreSQL) defined w/ own volume, env vars, ports. R service depends_on references new.
If err: DB fails start → docker compose logs postgres for init errs. Verify env vars (POSTGRES_PASSWORD_FILE → valid secret) or switch POSTGRES_PASSWORD for dev.
Step 3: Networking
For services needing localhost (MCP):
services:
r-dev:
network_mode: "host"
Isolated:
services:
r-dev:
networks:
- app-network
ports:
- "3000:3000"
networks:
app-network:
driver: bridge
→ Networking configured: host for localhost-needing (MCP), bridge w/ explicit ports for isolated.
If err: services can't comm → verify same net. Bridge → use service names as hostnames (postgres not localhost). Host → localhost + no port conflicts.
Step 4: Env Vars
.env (git-ignored):
R_VERSION=4.5.0
GITHUB_PAT=your_token_here
Reference:
services:
r-dev:
build:
args:
R_VERSION: ${R_VERSION}
env_file:
- .env
→ .env exists git-ignored w/ project vars; compose references via env_file|${VAR}.
If err: vars not resolving → .env in same dir as docker-compose.yml. docker compose config shows resolved.
Step 5: Build + Run
# Build images
docker compose build
# Start services
docker compose up -d
# Attach to R session
docker compose exec r-dev R
# View logs
docker compose logs -f r-dev
# Stop services
docker compose down
→ All start. R session accessible.
If err: docker compose logs → startup errs. Common: port conflicts, missing env vars.
Step 6: Override for Dev
docker-compose.override.yml:
services:
r-dev:
volumes:
- /path/to/local/packages:/extra-packages
environment:
- DEBUG=true
Auto-merged.
→ Override exists w/ dev settings (extra volumes, debug) auto-applied via docker compose up.
If err: not taking effect → verify exact docker-compose.override.yml. docker compose config confirms merge. Explicit: docker compose -f docker-compose.yml -f custom-override.yml up.
Check
-
docker compose buildw/o errs -
docker compose upstarts all - Volume mounts share files host↔container
- Env vars available inside
- Services can comm
-
docker compose downcleanly stops
Traps
- Volume mount perms: Linux containers create files as root.
user:directive or fix perms. - Port conflicts: Check services using same ports on host.
- Docker Desktop vs CLI:
docker compose(v2) vsdocker-compose(v1). Use v2. - WSL path mounts:
/mnt/c/...for Windows dirs from WSL. - Named vs bind: Named persist across rebuilds; bind reflects host immediately.
→
create-r-dockerfile— Dockerfile compose referencescontainerize-mcp-server— compose for MCPoptimize-docker-build-cache— speed up builds
GitHub Repository
Frequently asked questions
What is the setup-docker-compose skill?
setup-docker-compose is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform setup-docker-compose-related tasks without extra prompting.
How do I install setup-docker-compose?
Use the install commands on this page: add setup-docker-compose to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does setup-docker-compose belong to?
setup-docker-compose is in the Documentation category, tagged ai, api and mcp.
Is setup-docker-compose free to use?
Yes. setup-docker-compose is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
Related Skills
This skill fetches current Railway documentation to answer questions about features, functionality, or specific docs URLs. It ensures developers receive accurate, up-to-date information directly from Railway's official sources. Use it when users ask how Railway works or reference Railway documentation.
This Claude Skill provides expert guidance for writing Python code in n8n's Code nodes, specifically for using Python's standard library and working with n8n's special syntax like `_input`, `_json`, and `_node`. It helps developers understand Python's limitations within n8n and recommends using JavaScript for most workflows while offering Python solutions for specific data transformation needs.
The Archon skill provides RAG-powered semantic search and project management through a REST API. Use it for querying documentation, managing hierarchical projects/tasks, and performing knowledge retrieval with document upload capabilities. Always prioritize Archon first when searching external documentation before using other sources.
This Claude Skill provides expert guidance for writing JavaScript code in n8n's Code nodes. It covers essential n8n-specific syntax like `$input`/`$json` variables, HTTP helpers, and DateTime handling, while troubleshooting common errors. Use it when developing n8n workflows that require custom JavaScript processing in Code nodes.
