一键导入
docker-patterns
Docker patterns for this project — DooD (Docker-outside-of-Docker), compose conventions, container lifecycle, and dev-box workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Docker patterns for this project — DooD (Docker-outside-of-Docker), compose conventions, container lifecycle, and dev-box workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a new database migration for PostgreSQL. Covers file naming, SQL patterns, running, and updating dependent code.
Baseline code quality enforcer — naming conventions, import hygiene, type safety, and style rules for a FastAPI + asyncpg + PostgreSQL Python backend.
Database schema reference for the hello-world app's PostgreSQL instance. Use when writing queries, creating migrations, or debugging data issues.
Step-by-step checklist for adding a new API endpoint to a FastAPI + asyncpg app. Covers schema, query, route, and verification.
Project file tree and layout conventions. Use when navigating the codebase, finding where files belong, or understanding the project layout.
Test-driven development workflow for FastAPI + asyncpg apps. Write tests first, then implement, then refactor.
| name | docker-patterns |
| description | Docker patterns for this project — DooD (Docker-outside-of-Docker), compose conventions, container lifecycle, and dev-box workflow. |
| user-invokable | false |
This project runs inside a dev-box container that has the Docker socket mounted from the host. This means:
docker and docker compose commands inside the dev container control host Docker# dev-box mounts the host Docker socket
volumes:
- /var/run/docker.sock:/var/run/docker.sock
docker compose to manage services (never docker run for app services)services:
hello-world:
build: ./obviously-the-best-hello-world-app
ports:
- "8000:8000"
environment:
DB_HOST: postgres
DB_PORT: "5432"
DB_NAME: devdb
DB_USER: devuser
DB_PASSWORD: changeme
depends_on:
postgres:
condition: service_healthy
mem_limit: 256m
restart: unless-stopped
Always add health checks so depends_on with condition: service_healthy works:
healthcheck:
test: ["CMD-SHELL", "pg_isready -U devuser -d devdb"]
interval: 5s
timeout: 3s
retries: 5
Set mem_limit on every container to prevent runaway memory:
mem_limit: 256m # App containers
mem_limit: 512m # Database containers
Use docker stats to monitor actual usage and adjust.
docker compose up -d # All services
docker compose up -d hello-world # Single service
docker compose up -d --build hello-world # Rebuild and start
docker compose logs -f hello-world # Follow logs
docker compose logs --tail=50 hello-world # Last 50 lines
docker compose restart hello-world # Restart without rebuild
docker compose up -d --build hello-world # Rebuild + restart
IMPORTANT: For database containers, prefer docker restart over docker rm + docker run. Recreating a database container can reinitialize the data directory and destroy data.
Containers on the same compose network can reach each other by service name:
# From hello-world container, reach the DB:
DB_HOST = "postgres" # Service name, not localhost
DB_PORT = "5432" # Internal port, not host-mapped port
Services are exposed on host ports via ports: mapping:
http://localhost:8000 -> hello-world container
localhost:5432 -> postgres container
docker compose up -d --build hello-worlddocker compose logs -f hello-worldcurl http://localhost:8000/apiFor hot-reload during development, mount the source code:
volumes:
- ./obviously-the-best-hello-world-app:/app
command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]