docker-compose-basics
$
npx mdskill add TheBushidoCollective/han/docker-compose-basicsDefine and run multi-container Docker applications using Docker Compose YAML configuration.
- Helps with orchestrating and managing multi-container setups for development or deployment.
- Integrates with Docker Compose for container orchestration and depends on Docker services.
- Recommends actions based on YAML configuration files and common Docker Compose commands.
- Presents results through structured YAML examples and command-line instructions for execution.
SKILL.md
.github/skills/docker-compose-basicsView on GitHub ↗
---
name: docker-compose-basics
user-invocable: false
description: Use when defining and running multi-container Docker applications with Docker Compose YAML configuration.
allowed-tools: []
---
# Docker Compose Basics
Docker Compose for defining and running multi-container applications.
## Basic Structure
```yaml
version: '3.8'
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./html:/usr/share/nginx/html
environment:
- NGINX_HOST=localhost
depends_on:
- api
api:
build: ./api
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://db:5432/myapp
depends_on:
- db
db:
image: postgres:15
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: secret
POSTGRES_DB: myapp
volumes:
pgdata:
```
## Common Commands
```bash
# Start services
docker compose up
# Start in background
docker compose up -d
# Stop services
docker compose down
# View logs
docker compose logs -f
# Rebuild
docker compose build
# Execute command
docker compose exec web sh
# Scale service
docker compose up -d --scale api=3
```
## Best Practices
### Environment Variables
```yaml
services:
api:
environment:
- NODE_ENV=${NODE_ENV:-development}
- API_KEY=${API_KEY}
```
### Health Checks
```yaml
services:
web:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 3
```
### Resource Limits
```yaml
services:
api:
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
```
More from TheBushidoCollective/han
- absinthe-resolversUse when implementing GraphQL resolvers with Absinthe. Covers resolver patterns, dataloader integration, batching, and error handling.
- absinthe-schemaUse when designing GraphQL schemas with Absinthe. Covers type definitions, interfaces, unions, enums, and schema organization patterns.
- absinthe-subscriptionsUse when implementing real-time GraphQL subscriptions with Absinthe. Covers Phoenix channels, PubSub, and subscription patterns.
- act-docker-setupUse when configuring Docker environments for act, selecting runner images, managing container resources, or troubleshooting Docker-related issues with local GitHub Actions testing.
- act-local-testingUse when testing GitHub Actions workflows locally with act. Covers act CLI usage, Docker configuration, debugging workflows, and troubleshooting common issues when running workflows on your local machine.
- act-workflow-syntaxUse when creating or modifying GitHub Actions workflow files. Provides guidance on workflow syntax, triggers, jobs, steps, and expressions for creating valid GitHub Actions workflows that can be tested locally with act.
- ameba-configurationUse when configuring Ameba rules and settings for Crystal projects including .ameba.yml setup, rule management, severity levels, and code quality enforcement.
- ameba-custom-rulesUse when creating custom Ameba rules for Crystal code analysis including rule development, AST traversal, issue reporting, and rule testing.
- ameba-integrationUse when integrating Ameba into development workflows including CI/CD pipelines, pre-commit hooks, GitHub Actions, and automated code review processes.
- analyze-performanceAnalyze performance metrics and identify slow transactions in Sentry