Claude-skill-registry docker-compose
Multi-service orchestration with Docker Compose, focusing on network isolation, environment-specific profiles, and service discovery. Triggers: docker-compose, container-networking, docker-profiles, service-discovery, yaml-config.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/docker-compose" ~/.claude/skills/majiayu000-claude-skill-registry-docker-compose-3a1ba8 && rm -rf "$T"
manifest:
skills/data/docker-compose/SKILL.mdsource content
Docker Compose Orchestration
Overview
Docker Compose simplifies the management of multi-container applications. It enables service discovery through internal hostnames and provides mechanisms for environment-specific configurations using profiles.
When to Use
- Local Development: Spinning up a full stack (frontend, backend, DB) with one command.
- CI/CD Integration: Running isolated integration tests in containerized environments.
- Microservices: Orchestrating communication between multiple independent services.
Decision Tree
- Do you have services only needed for debugging?
- YES: Use
to keep them optional.profiles
- YES: Use
- Do you need to hide a database from the public proxy?
- YES: Create isolated custom
.networks
- YES: Create isolated custom
- Do you need to connect to a service outside the current YAML file?
- YES: Use
for that network.external: true
- YES: Use
Workflows
1. Isolating Internal Services
- Define
andfrontend
custom networks in the top-levelbackend
key.networks - Assign the
service to theproxy
network.frontend - Assign the
service to bothapp
andfrontend
.backend - Assign the
service only to thedb
network to isolate it from the proxy.backend
2. Environment-Specific Overrides with Profiles
- Add
to an optional service (e.g.,profiles: [debug]
) inphpmyadmin
.compose.yaml - Run
for standard operations; debug services stay off.docker compose up - Run
to include the debugging tools.docker compose --profile debug up
3. Using Existing External Networks
- Declare a network in
withcompose.yaml
.external: true - Link local services to this external network in their
section.networks - This allows the Compose stack to communicate with containers managed outside the current project.
Non-Obvious Insights
- Service Name as Hostname: Within the default network, you don't need IPs; containers connect via service names (e.g.,
).db:5432 - IP Persistence: Configurations changes cause containers to get new IPs, but the hostname (service name) remains consistent, which is why service discovery is essential.
- Implicit Enablement: Services without a
attribute are always enabled regardless of which profiles are requested.profiles
Evidence
- "Each container for a service joins the default network and is... discoverable by the service's name." - Docker Docs
- "Profiles help you adjust your Compose application for different environments... by selectively activating services." - Docker Docs
- "Instead of just using the default app network, you can specify your own networks..." - Docker Docs
Scripts
: Python script to generate dynamic Compose YAML files.scripts/docker-compose_tool.py
: Node.js script for checking service connectivity within a network.scripts/docker-compose_tool.js
Dependencies
docker-compose
enginedocker