docker-compose-guide — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited docker-compose-guide (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Write well-structured Docker Compose configurations for local development, testing, and production-like environments with proper networking, health checks, and dependency management.
Define services with explicit health checks so dependent services wait for readiness, not just container start.
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: myapp
POSTGRES_USER: myapp
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U myapp -d myapp"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
networks:
- backend
redis:
image: redis:7-alpine
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- backendUse depends_on with condition: service_healthy to ensure proper startup order.
services:
api:
build:
context: .
dockerfile: Dockerfile
target: development
volumes:
- .:/app
- /app/node_modules
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://myapp:secret@postgres:5432/myapp
REDIS_URL: redis://redis:6379
NODE_ENV: development
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- backend
- frontend
restart: unless-stoppedUse profiles to group services that are only needed in specific scenarios.
services:
app:
build: .
ports:
- "3000:3000"
mailhog:
image: mailhog/mailhog:latest
ports:
- "1025:1025"
- "8025:8025"
profiles:
- debug
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "5050:80"
profiles:
- debug
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
profiles:
- monitoringStart with profiles: docker compose --profile debug --profile monitoring up
Explicitly define networks for service isolation and named volumes for data persistence.
networks:
frontend:
driver: bridge
backend:
driver: bridge
internal: true # No external access
volumes:
postgres_data:
driver: local
redis_data:
driver: localUse .env files for defaults and environment for overrides. Never commit secrets.
services:
api:
env_file:
- .env
- .env.local # Overrides .env, not committed
environment:
LOG_LEVEL: ${LOG_LEVEL:-info}
APP_VERSION: ${APP_VERSION:?APP_VERSION is required}Example .env file:
# .env (committed, defaults only)
COMPOSE_PROJECT_NAME=myapp
LOG_LEVEL=info
NODE_ENV=developmentdepends_on only waits for container start, not service readiness. Always pair with condition: service_healthy./app/node_modules.env_file, Docker secrets, or environment variables. Never commit credentials.# Start all services
docker compose up -d
# Start with specific profiles
docker compose --profile debug up -d
# Rebuild and start
docker compose up -d --build
# View logs
docker compose logs -f api
# Scale a service
docker compose up -d --scale worker=3
# Stop and remove volumes
docker compose down -v
# Execute command in running container
docker compose exec api sh
# Run one-off command
docker compose run --rm api npm test~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.