setup-docker-compose
정보
이 스킬은 다중 컨테이너 R 개발 환경을 위해 Docker Compose를 구성하여 데이터베이스나 API 같은 서비스와 함께 R을 실행할 수 있게 합니다. 개발 및 프로덕션 설정 모두를 위한 서비스 정의, 볼륨 마운트, 네트워킹, 환경 설정을 다룹니다. 재현 가능한 R 환경을 만들거나 R 기반 컨테이너 서비스를 오케스트레이션하는 데 사용하세요.
빠른 설치
Claude Code
추천npx 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-composeClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Set Up Docker Compose
Configure Docker Compose for R development and deployment environments.
When to Use
- Running R alongside other services (databases, APIs)
- Setting up a reproducible development environment
- Orchestrating an R-based MCP server container
- Managing environment variables and volume mounts
Inputs
- Required: Dockerfile for the R service
- Required: Project directory to mount
- Optional: Additional services (database, cache, web server)
- Optional: Environment variable configuration
Procedure
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
Got: A docker-compose.yml file with the R service defined, including volume mounts for the project directory and renv cache, and environment variables for R library paths.
If fail: With invalid YAML, validate using docker compose config. Ensure indentation uses spaces (not tabs) and all string values with special characters are quoted.
Step 2: Add Additional 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:
Got: The additional service (e.g., PostgreSQL) is defined with its own volume, environment variables, and port mapping. The R service has depends_on referencing the new service.
If fail: If the database service fails to start, check docker compose logs postgres for initialization errors. Verify that environment variables like POSTGRES_PASSWORD_FILE point to valid secrets or switch to POSTGRES_PASSWORD for development.
Step 3: Configure Networking
For services that need localhost access (e.g., MCP servers):
services:
r-dev:
network_mode: "host"
For isolated networking:
services:
r-dev:
networks:
- app-network
ports:
- "3000:3000"
networks:
app-network:
driver: bridge
Got: Networking configured appropriately: host mode for services needing localhost access (MCP servers), or bridge networking with explicit port mappings for isolated services.
If fail: If services cannot communicate, verify they are on the same network. With bridge networking, use service names as hostnames (e.g., postgres not localhost). With host mode, use localhost and ensure ports do not conflict.
Step 4: Manage Environment Variables
Create .env file (git-ignored):
R_VERSION=4.5.0
GITHUB_PAT=your_token_here
Reference in compose:
services:
r-dev:
build:
args:
R_VERSION: ${R_VERSION}
env_file:
- .env
Got: A .env file (git-ignored) with project-specific variables, and docker-compose.yml references it via env_file or variable interpolation (${VAR}).
If fail: If variables are not resolving, ensure the .env file is in the same directory as docker-compose.yml. Run docker compose config to see the resolved configuration with all variables expanded.
Step 5: Build and 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
Got: All services start. R session accessible.
If fail: Check docker compose logs for startup errors. Common: port conflicts, missing environment variables.
Step 6: Create Override for Development
Create docker-compose.override.yml for local development settings:
services:
r-dev:
volumes:
- /path/to/local/packages:/extra-packages
environment:
- DEBUG=true
This is automatically merged with docker-compose.yml.
Got: A docker-compose.override.yml file with development-specific settings (extra volumes, debug flags) automatically applied when running docker compose up.
If fail: If overrides are not taking effect, verify the filename is exactly docker-compose.override.yml. Run docker compose config to confirm the merge. For explicit override files, use docker compose -f docker-compose.yml -f custom-override.yml up.
Validation
-
docker compose buildcompletes without errors -
docker compose upstarts all services - Volume mounts correctly share files between host and container
- Environment variables are available inside containers
- Services can communicate with each other
-
docker compose downcleanly stops everything
Pitfalls
- Volume mount permissions: Linux containers may create files as root. Use
user:directive or fix permissions. - Port conflicts: Check for services already using the same ports on the host
- Docker Desktop vs CLI:
docker compose(v2) vsdocker-compose(v1). Use v2. - WSL path mounts: Use
/mnt/c/...paths when mounting Windows directories from WSL - Named volumes vs bind mounts: Named volumes persist across rebuilds; bind mounts reflect host changes immediately
Related Skills
create-r-dockerfile- create the Dockerfile that compose referencescontainerize-mcp-server- compose configuration for MCP serversoptimize-docker-build-cache- speed up compose builds
GitHub 저장소
연관 스킬
railway-docs
문서이 스킬은 Railway의 기능, 작동 방식 또는 특정 문서 URL에 대한 질문에 답하기 위해 최신 Railway 문서를 가져옵니다. 개발자들이 Railway의 공식 소스로부터 정확하고 최신 정보를 직접 받을 수 있도록 보장합니다. 사용자가 Railway의 작동 방식을 묻거나 Railway 문서를 참조할 때 사용하세요.
n8n-code-python
문서이 Claude Skill은 n8n의 Code 노드에서 Python 코드를 작성할 때 전문적인 지침을 제공하며, 특히 Python 표준 라이브러리 사용과 n8n의 특수 구문인 `_input`, `_json`, `_node` 작업에 중점을 둡니다. 이는 개발자가 n8n 내에서 Python의 제한 사항을 이해하도록 돕고, 대부분의 워크플로에는 JavaScript 사용을 권장하면서도 특정 데이터 변환 요구사항에 대한 Python 솔루션을 제안합니다.
archon
문서Archon 스킬은 REST API를 통해 RAG 기반 시맨틱 검색과 프로젝트 관리를 제공합니다. 이 스킬을 사용하여 문서 검색, 계층적 프로젝트/태스크 관리, 문서 업로드 기능을 갖춘 지식 검색을 수행할 수 있습니다. 외부 문서를 검색할 때는 다른 소스를 사용하기 전에 항상 Archon을 최우선으로 활용하세요.
n8n-code-javascript
문서이 Claude Skill은 n8n의 Code 노드에서 JavaScript 코드 작성에 대한 전문적인 지침을 제공합니다. `$input`/`$json` 변수, HTTP 헬퍼, DateTime 처리와 같은 필수적인 n8n 특정 구문을 다루며 일반적인 오류를 해결합니다. Code 노드에서 사용자 정의 JavaScript 처리가 필요한 n8n 워크플로우를 개발할 때 활용하세요.
