Skip to content
Back to skills

Docker Compose Basics

ASecurity

Use when defining and running multi-container Docker applications with Docker Compose YAML configuration.

  • 666 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 8, 2026
devopsbashsqlnodedockerapidatabase

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill docker-compose-basics --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker Compose Basics?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker Compose Basics
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-docker-compose-basics/badge)](https://www.skillsdirectory.com/skills/majiayu000-docker-compose-basics)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docker-compose-basics
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
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.