[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B2AEECS2TC34MB5FC96PHH":3,"skill-same:01M7B2AEECS2TC34MB5FC96PHH":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7B2AEECS2TC34MB5FC96PHH","docker-patterns",null,"Docker and Docker Compose patterns for local development, hardened CLI installer harnesses, container security, networking, volumes, and multi-service orchestration. Use when creating or reviewing Dockerfiles and Compose services, testing installers across Linux distributions, or planning accurate native macOS and Windows validation.","lytong760-cell\u002Fcompiler_ko","lytong760-cell","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F289977458?v=4","01M7B1YD239K88PFQRD4PVC9DW","Nguyên Games","01M7B1YD2RM70TZ71QNQ0XTN4R",2,"MIT","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fdocker-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: docker-patterns\ndescription: Docker and Docker Compose patterns for local development, hardened CLI installer harnesses, container security, networking, volumes, and multi-service orchestration. Use when creating or reviewing Dockerfiles and Compose services, testing installers across Linux distributions, or planning accurate native macOS and Windows validation.\n---\n\n# Docker Patterns\n\nDocker and Docker Compose best practices for containerized development.\n\n## Docker Compose for Local Development\n\n### Standard Web App Stack\n\n```yaml\n# docker-compose.yml\nservices:\n  app:\n    build:\n      context: .\n      target: dev                     # Use dev stage of multi-stage Dockerfile\n    ports:\n      - \"3000:3000\"\n    volumes:\n      - .:\u002Fapp                        # Bind mount for hot reload\n      - \u002Fapp\u002Fnode_modules             # Anonymous volume -- preserves container deps\n    environment:\n      - DATABASE_URL=postgres:\u002F\u002Fpostgres:postgres@db:5432\u002Fapp_dev\n      - REDIS_URL=redis:\u002F\u002Fredis:6379\u002F0\n      - NODE_ENV=development\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_started\n    command: npm run dev\n\n  db:\n    image: postgres:16-alpine\n    ports:\n      - \"5432:5432\"\n    environment:\n      POSTGRES_USER: postgres\n      POSTGRES_PASSWORD: postgres\n      POSTGRES_DB: app_dev\n    volumes:\n      - pgdata:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n      - .\u002Fscripts\u002Finit-db.sql:\u002Fdocker-entrypoint-initdb.d\u002Finit.sql\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]\n      interval: 5s\n      timeout: 3s\n      retries: 5\n\n  redis:\n    image: redis:7-alpine\n    ports:\n      - \"6379:6379\"\n    volumes:\n      - redisdata:\u002Fdata\n\n  mailpit:                            # Local email testing\n    image: axllent\u002Fmailpit\n    ports:\n      - \"8025:8025\"                   # Web UI\n      - \"1025:1025\"                   # SMTP\n\nvolumes:\n  pgdata:\n  redisdata:\n```\n\n### Development vs Production Dockerfile\n\n```dockerfile\n# Stage: dependencies\nFROM node:22-alpine AS deps\nWORKDIR \u002Fapp\nCOPY package.json package-lock.json .\u002F\nRUN npm ci\n\n# Stage: dev (hot reload, debug tools)\nFROM node:22-alpine AS dev\nWORKDIR \u002Fapp\nCOPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY . .\nEXPOSE 3000\nCMD [\"npm\", \"run\", \"dev\"]\n\n# Stage: build\nFROM node:22-alpine AS build\nWORKDIR \u002Fapp\nCOPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY . .\nRUN npm run build && npm prune --production\n\n# Stage: production (minimal image)\nFROM node:22-alpine AS production\nWORKDIR \u002Fapp\nRUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001\nUSER appuser\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fdist .\u002Fdist\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fpackage.json .\u002F\nENV NODE_ENV=production\nEXPOSE 3000\nHEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http:\u002F\u002Flocalhost:3000\u002Fhealth || exit 1\nCMD [\"node\", \"dist\u002Fserver.js\"]\n```\n\n### Override Files\n\n```yaml\n# docker-compose.override.yml (auto-loaded, dev-only settings)\nservices:\n  app:\n    environment:\n      - DEBUG=app:*\n      - LOG_LEVEL=debug\n    ports:\n      - \"9229:9229\"                   # Node.js debugger\n\n# docker-compose.prod.yml (explicit for production)\nservices:\n  app:\n    build:\n      target: production\n    restart: always\n    deploy:\n      resources:\n        limits:\n          cpus: \"1.0\"\n          memory: 512M\n```\n\n```bash\n# Development (auto-loads override)\ndocker compose up\n\n# Production\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml up -d\n```\n\n## Networking\n\n### Service Discovery\n\nServices in the same Compose network resolve by service name:\n```\n# From \"app\" container:\npostgres:\u002F\u002Fpostgres:postgres@db:5432\u002Fapp_dev    # \"db\" resolves to the db container\nredis:\u002F\u002Fredis:6379\u002F0                             # \"redis\" resolves to the redis container\n```\n\n### Custom Networks\n\n```yaml\nservices:\n  frontend:\n    networks:\n      - frontend-net\n\n  api:\n    networks:\n      - frontend-net\n      - backend-net\n\n  db:\n    networks:\n      - backend-net              # Only reachable from api, not frontend\n\nnetworks:\n  frontend-net:\n  backend-net:\n```\n\n### Exposing Only What's Needed\n\n```yaml\nservices:\n  db:\n    ports:\n      - \"127.0.0.1:5432:5432\"   # Only accessible from host, not network\n    # Omit ports entirely in production -- accessible only within Docker network\n```\n\n## Volume Strategies\n\n```yaml\nvolumes:\n  # Named volume: persists across container restarts, managed by Docker\n  pgdata:\n\n  # Bind mount: maps host directory into container (for development)\n  # - .\u002Fsrc:\u002Fapp\u002Fsrc\n\n  # Anonymous volume: preserves container-generated content from bind mount override\n  # - \u002Fapp\u002Fnode_modules\n```\n\n### Common Patterns\n\n```yaml\nservices:\n  app:\n    volumes:\n      - .:\u002Fapp                   # Source code (bind mount for hot reload)\n      - \u002Fapp\u002Fnode_modules        # Protect container's node_modules from host\n      - \u002Fapp\u002F.next               # Protect build cache\n\n  db:\n    volumes:\n      - pgdata:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata          # Persistent data\n      - .\u002Fscripts\u002Finit.sql:\u002Fdocker-entrypoint-initdb.d\u002Finit.sql  # Init scripts\n```\n\n## Container Security\n\n### Dockerfile Hardening\n\n```dockerfile\n# 1. Use specific tags (never :latest)\nFROM node:22.12-alpine3.20\n\n# 2. Run as non-root\nRUN addgroup -g 1001 -S app && adduser -S app -u 1001\nUSER app\n\n# 3. Drop capabilities (in compose)\n# 4. Read-only root filesystem where possible\n# 5. No secrets in image layers\n```\n\n### Compose Security\n\n```yaml\nservices:\n  app:\n    security_opt:\n      - no-new-privileges:true\n    read_only: true\n    tmpfs:\n      - \u002Ftmp\n      - \u002Fapp\u002F.cache\n    cap_drop:\n      - ALL\n    cap_add:\n      - NET_BIND_SERVICE          # Only if binding to ports \u003C 1024\n```\n\n### Secret Management\n\n```yaml\n# GOOD: Use environment variables (injected at runtime)\nservices:\n  app:\n    env_file:\n      - .env                     # Never commit .env to git\n    environment:\n      - API_KEY                  # Inherits from host environment\n\n# GOOD: Docker secrets (Swarm mode)\nsecrets:\n  db_password:\n    file: .\u002Fsecrets\u002Fdb_password.txt\n\nservices:\n  db:\n    secrets:\n      - db_password\n\n# BAD: Hardcoded in image\n# ENV API_KEY=sk-proj-xxxxx      # NEVER DO THIS\n```\n\n## Hardened CLI Installer Harnesses\n\nUse containers to test installer behavior against disposable project copies without allowing the test to mutate the source checkout.\n\n### Respect the Platform Boundary\n\n- Run real containers for Linux distributions such as Debian and Ubuntu.\n- macOS cannot run as a Docker container because Docker shares a Linux kernel. Run the same shell-free test entry point natively on macOS.\n- Windows containers require a Windows Docker engine. Run platform-independent logic on a native Windows CI runner and reserve Windows containers for a Windows host.\n- Keep a native Ubuntu\u002FmacOS\u002FWindows CI matrix for host-specific paths, command shims, quoting, and filesystem behavior.\n\nDo not claim that a Linux container validates macOS or Windows behavior.\n\n### Enforce the Isolation Contract\n\n- Pin base images by immutable digest and pin installed CLI versions.\n- Run as a non-root numeric UID\u002FGID when distro account names differ.\n- Mount the repository and source project read-only.\n- Copy the source project into a writable `tmpfs` workspace before any mutation.\n- Mount `\u002Fworkspace` with `noexec`, UID\u002FGID 1000, and `mode=0700` so only the\n  container user can inspect project data.\n- Keep npm and npx's executable cache at `NPM_CONFIG_CACHE=\u002Ftmp\u002Fnpm-cache` on\n  the executable `\u002Ftmp` mount. Its default size is 2 GiB and can be adjusted\n  with `ECC_TMPFS_SIZE`; `ECC_WORKSPACE_SIZE` separately controls the private\n  workspace mount.\n- Set `read_only: true`, `no-new-privileges:true`, `cap_drop: [ALL]`, and a finite `pids_limit`.\n- Keep the default real-CLI services on `network_mode: none`. Add network access\n  only through a visibly named opt-in service for an authenticated provider\n  session; never make it an accidental environment-driven default.\n- Create only the writable temporary paths the tool needs.\n- Do not pass host credentials into the container by default.\n- Default to a dry run and whitelist only the explicit `dry-run`, `install`,\n  `plugin`, and `shell` modes.\n- Use argument arrays or `spawnSync(..., { shell: false })` for cross-platform runners. Never interpolate project paths into a shell command.\n\n### Exercise the ECC Plugin Setup Harness\n\nUse `docker\u002Fplugin-setup\u002Fcompose.yaml` as the reference implementation. It provides:\n\n- `fixture-tests` for the focused install manifest, target, and executor suite.\n- `real-cli` for the pinned Debian-based generic Linux image.\n- `real-cli-ubuntu` for the pinned Ubuntu image.\n\nValidate the Compose model before building:\n\n```bash\ndocker compose -f docker\u002Fplugin-setup\u002Fcompose.yaml config --quiet\n```\n\nBuild both real Linux images:\n\n```bash\ndocker compose -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  build real-cli real-cli-ubuntu\n```\n\nRun the safe default flow in each image:\n\n```bash\ndocker compose -p ecc-plugin-debian-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --rm -T real-cli dry-run\n\ndocker compose -p ecc-plugin-ubuntu-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --rm -T real-cli-ubuntu dry-run\n```\n\nThe dry run executes the current public command contract:\n\n```bash\necc install --profile core --target claude-project --dry-run --json\n```\n\nBefore that command runs, the container creates a locally packed npm artifact\nfrom the read-only checkout with `npm pack --ignore-scripts`. It extracts the\nself-created tarball under `\u002Ftmp`, validates the `ecc-universal` package name,\nrequired install manifests, and the confined `package.json` `bin.ecc` mapping,\nthen invokes the extracted `ecc` executable. The runtime stays on\n`network_mode: none`, does not execute package lifecycle scripts, and does not\nrely on host `node_modules`; its exact pinned production dependencies are\nalready present in the image.\n\nThe harness rejects an empty plan, a non-`claude-project` target, any operation\noutside `\u002Fworkspace\u002Fproject\u002F.claude`, or any dry run that creates the target\ndirectory. `install` performs the isolated apply twice, checks its managed\ninstall state, lists the installed target, and runs `doctor`.\n\n### Start, Open, Reconnect, and Clean Up a Named Session\n\nStart a detached container without `--rm` so leaving a terminal does not remove\nthe session:\n\n```bash\ndocker compose -p ecc-plugin-session \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --detach --name ecc-plugin-shell real-cli shell\n```\n\nThe container copies the read-only fixture to the stable private directory\n`\u002Fworkspace\u002Fproject`. Confirm it is running, then emit the Docker side of the\nterminal-opener v1 data contract:\n\n```bash\ndocker inspect --format '{{.State.Running}}' ecc-plugin-shell\nnode docker\u002Fplugin-setup\u002Finteractive-plan.js \\\n  --container ecc-plugin-shell \\\n  --workdir \u002Fworkspace\u002Fproject \\\n  --json \\\n  -- bash\n```\n\nThe JSON result has exactly an `executable` and `argv` boundary (plus\n`contractVersion: 1`): the executable is `docker`, and argv begins with\n`exec`, `-it`, and `-w`. Pass that data to the separate terminal-opener skill\nwhen it is installed. This Docker harness deliberately does not import a\nterminal adapter, interpolate a shell command, or manage a host GUI process.\nUntil then, open the same PTY in the current host terminal directly:\n\n```bash\ndocker exec -it -w \u002Fworkspace\u002Fproject ecc-plugin-shell bash\n```\n\nExit the shell without stopping the detached container. Reconnect with the\nsame `docker exec -it` command. When finished, remove the exact named container\nand its Compose project resources:\n\n```bash\ndocker rm --force ecc-plugin-shell\ndocker compose -p ecc-plugin-session \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  down --remove-orphans\n```\n\nHost credentials are absent by default and credential directories are never\nmounted. The default service also has no network access. When an authenticated\nprovider session genuinely needs a network, build `real-cli` first and then opt\nin visibly with `docker compose --profile networked run real-cli-networked\nshell`. Prefer authenticating inside that disposable session. If a CI run must\ninherit a host environment credential, make that opt-in at invocation with an\nexplicit Compose `--env NAME` flag, understand that the value is inspectable\nand can be exfiltrated for the container lifetime, and remove the exact named\ncontainer immediately after.\n\nRun the same focused suite natively on the host:\n\n```bash\nnpm run test:plugin-setup-platform\n```\n\nInspect the produced identity and environment before trusting the image:\n\n```bash\ndocker image inspect ecc-plugin-setup:debian ecc-plugin-setup:ubuntu\n```\n\nClean each named test project without deleting unrelated volumes or images:\n\n```bash\ndocker compose -p ecc-plugin-debian-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml down --remove-orphans\ndocker compose -p ecc-plugin-ubuntu-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml down --remove-orphans\n```\n\n## .dockerignore\n\n```\nnode_modules\n.git\n.env\n.env.*\ndist\ncoverage\n*.log\n.next\n.cache\ndocker-compose*.yml\nDockerfile*\nREADME.md\ntests\u002F\n```\n\n## Debugging\n\n### Common Commands\n\n```bash\n# View logs\ndocker compose logs -f app           # Follow app logs\ndocker compose logs --tail=50 db     # Last 50 lines from db\n\n# Execute commands in running container\ndocker compose exec app sh           # Shell into app\ndocker compose exec db psql -U postgres  # Connect to postgres\n\n# Inspect\ndocker compose ps                     # Running services\ndocker compose top                    # Processes in each container\ndocker stats                          # Resource usage\n\n# Rebuild\ndocker compose up --build             # Rebuild images\ndocker compose build --no-cache app   # Force full rebuild\n\n# Clean up\ndocker compose down                   # Stop and remove containers\ndocker compose down -v                # Also remove volumes (DESTRUCTIVE)\ndocker system prune                   # Remove unused images\u002Fcontainers\n```\n\n### Debugging Network Issues\n\n```bash\n# Check DNS resolution inside container\ndocker compose exec app nslookup db\n\n# Check connectivity\ndocker compose exec app wget -qO- http:\u002F\u002Fapi:3000\u002Fhealth\n\n# Inspect network\ndocker network ls\ndocker network inspect \u003Cproject>_default\n```\n\n## Anti-Patterns\n\n```\n# BAD: Using docker compose in production without orchestration\n# Use Kubernetes, ECS, or Docker Swarm for production multi-container workloads\n\n# BAD: Storing data in containers without volumes\n# Containers are ephemeral -- all data lost on restart without volumes\n\n# BAD: Running as root\n# Always create and use a non-root user\n\n# BAD: Using :latest tag\n# Pin to specific versions for reproducible builds\n\n# BAD: One giant container with all services\n# Separate concerns: one process per container\n\n# BAD: Putting secrets in docker-compose.yml\n# Use .env files (gitignored) or Docker secrets\n```\n","# Docker Patterns\n\nDocker and Docker Compose best practices for containerized development.\n\n## Docker Compose for Local Development\n\n### Standard Web App Stack\n\n```yaml\n# docker-compose.yml\nservices:\n  app:\n    build:\n      context: .\n      target: dev                     # Use dev stage of multi-stage Dockerfile\n    ports:\n      - \"3000:3000\"\n    volumes:\n      - .:\u002Fapp                        # Bind mount for hot reload\n      - \u002Fapp\u002Fnode_modules             # Anonymous volume -- preserves container deps\n    environment:\n      - DATABASE_URL=postgres:\u002F\u002Fpostgres:postgres@db:5432\u002Fapp_dev\n      - REDIS_URL=redis:\u002F\u002Fredis:6379\u002F0\n      - NODE_ENV=development\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_started\n    command: npm run dev\n\n  db:\n    image: postgres:16-alpine\n    ports:\n      - \"5432:5432\"\n    environment:\n      POSTGRES_USER: postgres\n      POSTGRES_PASSWORD: postgres\n      POSTGRES_DB: app_dev\n    volumes:\n      - pgdata:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n      - .\u002Fscripts\u002Finit-db.sql:\u002Fdocker-entrypoint-initdb.d\u002Finit.sql\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]\n      interval: 5s\n      timeout: 3s\n      retries: 5\n\n  redis:\n    image: redis:7-alpine\n    ports:\n      - \"6379:6379\"\n    volumes:\n      - redisdata:\u002Fdata\n\n  mailpit:                            # Local email testing\n    image: axllent\u002Fmailpit\n    ports:\n      - \"8025:8025\"                   # Web UI\n      - \"1025:1025\"                   # SMTP\n\nvolumes:\n  pgdata:\n  redisdata:\n```\n\n### Development vs Production Dockerfile\n\n```dockerfile\n# Stage: dependencies\nFROM node:22-alpine AS deps\nWORKDIR \u002Fapp\nCOPY package.json package-lock.json .\u002F\nRUN npm ci\n\n# Stage: dev (hot reload, debug tools)\nFROM node:22-alpine AS dev\nWORKDIR \u002Fapp\nCOPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY . .\nEXPOSE 3000\nCMD [\"npm\", \"run\", \"dev\"]\n\n# Stage: build\nFROM node:22-alpine AS build\nWORKDIR \u002Fapp\nCOPY --from=deps \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY . .\nRUN npm run build && npm prune --production\n\n# Stage: production (minimal image)\nFROM node:22-alpine AS production\nWORKDIR \u002Fapp\nRUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001\nUSER appuser\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fdist .\u002Fdist\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fnode_modules .\u002Fnode_modules\nCOPY --from=build --chown=appuser:appgroup \u002Fapp\u002Fpackage.json .\u002F\nENV NODE_ENV=production\nEXPOSE 3000\nHEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http:\u002F\u002Flocalhost:3000\u002Fhealth || exit 1\nCMD [\"node\", \"dist\u002Fserver.js\"]\n```\n\n### Override Files\n\n```yaml\n# docker-compose.override.yml (auto-loaded, dev-only settings)\nservices:\n  app:\n    environment:\n      - DEBUG=app:*\n      - LOG_LEVEL=debug\n    ports:\n      - \"9229:9229\"                   # Node.js debugger\n\n# docker-compose.prod.yml (explicit for production)\nservices:\n  app:\n    build:\n      target: production\n    restart: always\n    deploy:\n      resources:\n        limits:\n          cpus: \"1.0\"\n          memory: 512M\n```\n\n```bash\n# Development (auto-loads override)\ndocker compose up\n\n# Production\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml up -d\n```\n\n## Networking\n\n### Service Discovery\n\nServices in the same Compose network resolve by service name:\n```\n# From \"app\" container:\npostgres:\u002F\u002Fpostgres:postgres@db:5432\u002Fapp_dev    # \"db\" resolves to the db container\nredis:\u002F\u002Fredis:6379\u002F0                             # \"redis\" resolves to the redis container\n```\n\n### Custom Networks\n\n```yaml\nservices:\n  frontend:\n    networks:\n      - frontend-net\n\n  api:\n    networks:\n      - frontend-net\n      - backend-net\n\n  db:\n    networks:\n      - backend-net              # Only reachable from api, not frontend\n\nnetworks:\n  frontend-net:\n  backend-net:\n```\n\n### Exposing Only What's Needed\n\n```yaml\nservices:\n  db:\n    ports:\n      - \"127.0.0.1:5432:5432\"   # Only accessible from host, not network\n    # Omit ports entirely in production -- accessible only within Docker network\n```\n\n## Volume Strategies\n\n```yaml\nvolumes:\n  # Named volume: persists across container restarts, managed by Docker\n  pgdata:\n\n  # Bind mount: maps host directory into container (for development)\n  # - .\u002Fsrc:\u002Fapp\u002Fsrc\n\n  # Anonymous volume: preserves container-generated content from bind mount override\n  # - \u002Fapp\u002Fnode_modules\n```\n\n### Common Patterns\n\n```yaml\nservices:\n  app:\n    volumes:\n      - .:\u002Fapp                   # Source code (bind mount for hot reload)\n      - \u002Fapp\u002Fnode_modules        # Protect container's node_modules from host\n      - \u002Fapp\u002F.next               # Protect build cache\n\n  db:\n    volumes:\n      - pgdata:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata          # Persistent data\n      - .\u002Fscripts\u002Finit.sql:\u002Fdocker-entrypoint-initdb.d\u002Finit.sql  # Init scripts\n```\n\n## Container Security\n\n### Dockerfile Hardening\n\n```dockerfile\n# 1. Use specific tags (never :latest)\nFROM node:22.12-alpine3.20\n\n# 2. Run as non-root\nRUN addgroup -g 1001 -S app && adduser -S app -u 1001\nUSER app\n\n# 3. Drop capabilities (in compose)\n# 4. Read-only root filesystem where possible\n# 5. No secrets in image layers\n```\n\n### Compose Security\n\n```yaml\nservices:\n  app:\n    security_opt:\n      - no-new-privileges:true\n    read_only: true\n    tmpfs:\n      - \u002Ftmp\n      - \u002Fapp\u002F.cache\n    cap_drop:\n      - ALL\n    cap_add:\n      - NET_BIND_SERVICE          # Only if binding to ports \u003C 1024\n```\n\n### Secret Management\n\n```yaml\n# GOOD: Use environment variables (injected at runtime)\nservices:\n  app:\n    env_file:\n      - .env                     # Never commit .env to git\n    environment:\n      - API_KEY                  # Inherits from host environment\n\n# GOOD: Docker secrets (Swarm mode)\nsecrets:\n  db_password:\n    file: .\u002Fsecrets\u002Fdb_password.txt\n\nservices:\n  db:\n    secrets:\n      - db_password\n\n# BAD: Hardcoded in image\n# ENV API_KEY=sk-proj-xxxxx      # NEVER DO THIS\n```\n\n## Hardened CLI Installer Harnesses\n\nUse containers to test installer behavior against disposable project copies without allowing the test to mutate the source checkout.\n\n### Respect the Platform Boundary\n\n- Run real containers for Linux distributions such as Debian and Ubuntu.\n- macOS cannot run as a Docker container because Docker shares a Linux kernel. Run the same shell-free test entry point natively on macOS.\n- Windows containers require a Windows Docker engine. Run platform-independent logic on a native Windows CI runner and reserve Windows containers for a Windows host.\n- Keep a native Ubuntu\u002FmacOS\u002FWindows CI matrix for host-specific paths, command shims, quoting, and filesystem behavior.\n\nDo not claim that a Linux container validates macOS or Windows behavior.\n\n### Enforce the Isolation Contract\n\n- Pin base images by immutable digest and pin installed CLI versions.\n- Run as a non-root numeric UID\u002FGID when distro account names differ.\n- Mount the repository and source project read-only.\n- Copy the source project into a writable `tmpfs` workspace before any mutation.\n- Mount `\u002Fworkspace` with `noexec`, UID\u002FGID 1000, and `mode=0700` so only the\n  container user can inspect project data.\n- Keep npm and npx's executable cache at `NPM_CONFIG_CACHE=\u002Ftmp\u002Fnpm-cache` on\n  the executable `\u002Ftmp` mount. Its default size is 2 GiB and can be adjusted\n  with `ECC_TMPFS_SIZE`; `ECC_WORKSPACE_SIZE` separately controls the private\n  workspace mount.\n- Set `read_only: true`, `no-new-privileges:true`, `cap_drop: [ALL]`, and a finite `pids_limit`.\n- Keep the default real-CLI services on `network_mode: none`. Add network access\n  only through a visibly named opt-in service for an authenticated provider\n  session; never make it an accidental environment-driven default.\n- Create only the writable temporary paths the tool needs.\n- Do not pass host credentials into the container by default.\n- Default to a dry run and whitelist only the explicit `dry-run`, `install`,\n  `plugin`, and `shell` modes.\n- Use argument arrays or `spawnSync(..., { shell: false })` for cross-platform runners. Never interpolate project paths into a shell command.\n\n### Exercise the ECC Plugin Setup Harness\n\nUse `docker\u002Fplugin-setup\u002Fcompose.yaml` as the reference implementation. It provides:\n\n- `fixture-tests` for the focused install manifest, target, and executor suite.\n- `real-cli` for the pinned Debian-based generic Linux image.\n- `real-cli-ubuntu` for the pinned Ubuntu image.\n\nValidate the Compose model before building:\n\n```bash\ndocker compose -f docker\u002Fplugin-setup\u002Fcompose.yaml config --quiet\n```\n\nBuild both real Linux images:\n\n```bash\ndocker compose -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  build real-cli real-cli-ubuntu\n```\n\nRun the safe default flow in each image:\n\n```bash\ndocker compose -p ecc-plugin-debian-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --rm -T real-cli dry-run\n\ndocker compose -p ecc-plugin-ubuntu-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --rm -T real-cli-ubuntu dry-run\n```\n\nThe dry run executes the current public command contract:\n\n```bash\necc install --profile core --target claude-project --dry-run --json\n```\n\nBefore that command runs, the container creates a locally packed npm artifact\nfrom the read-only checkout with `npm pack --ignore-scripts`. It extracts the\nself-created tarball under `\u002Ftmp`, validates the `ecc-universal` package name,\nrequired install manifests, and the confined `package.json` `bin.ecc` mapping,\nthen invokes the extracted `ecc` executable. The runtime stays on\n`network_mode: none`, does not execute package lifecycle scripts, and does not\nrely on host `node_modules`; its exact pinned production dependencies are\nalready present in the image.\n\nThe harness rejects an empty plan, a non-`claude-project` target, any operation\noutside `\u002Fworkspace\u002Fproject\u002F.claude`, or any dry run that creates the target\ndirectory. `install` performs the isolated apply twice, checks its managed\ninstall state, lists the installed target, and runs `doctor`.\n\n### Start, Open, Reconnect, and Clean Up a Named Session\n\nStart a detached container without `--rm` so leaving a terminal does not remove\nthe session:\n\n```bash\ndocker compose -p ecc-plugin-session \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  run --detach --name ecc-plugin-shell real-cli shell\n```\n\nThe container copies the read-only fixture to the stable private directory\n`\u002Fworkspace\u002Fproject`. Confirm it is running, then emit the Docker side of the\nterminal-opener v1 data contract:\n\n```bash\ndocker inspect --format '{{.State.Running}}' ecc-plugin-shell\nnode docker\u002Fplugin-setup\u002Finteractive-plan.js \\\n  --container ecc-plugin-shell \\\n  --workdir \u002Fworkspace\u002Fproject \\\n  --json \\\n  -- bash\n```\n\nThe JSON result has exactly an `executable` and `argv` boundary (plus\n`contractVersion: 1`): the executable is `docker`, and argv begins with\n`exec`, `-it`, and `-w`. Pass that data to the separate terminal-opener skill\nwhen it is installed. This Docker harness deliberately does not import a\nterminal adapter, interpolate a shell command, or manage a host GUI process.\nUntil then, open the same PTY in the current host terminal directly:\n\n```bash\ndocker exec -it -w \u002Fworkspace\u002Fproject ecc-plugin-shell bash\n```\n\nExit the shell without stopping the detached container. Reconnect with the\nsame `docker exec -it` command. When finished, remove the exact named container\nand its Compose project resources:\n\n```bash\ndocker rm --force ecc-plugin-shell\ndocker compose -p ecc-plugin-session \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml \\\n  down --remove-orphans\n```\n\nHost credentials are absent by default and credential directories are never\nmounted. The default service also has no network access. When an authenticated\nprovider session genuinely needs a network, build `real-cli` first and then opt\nin visibly with `docker compose --profile networked run real-cli-networked\nshell`. Prefer authenticating inside that disposable session. If a CI run must\ninherit a host environment credential, make that opt-in at invocation with an\nexplicit Compose `--env NAME` flag, understand that the value is inspectable\nand can be exfiltrated for the container lifetime, and remove the exact named\ncontainer immediately after.\n\nRun the same focused suite natively on the host:\n\n```bash\nnpm run test:plugin-setup-platform\n```\n\nInspect the produced identity and environment before trusting the image:\n\n```bash\ndocker image inspect ecc-plugin-setup:debian ecc-plugin-setup:ubuntu\n```\n\nClean each named test project without deleting unrelated volumes or images:\n\n```bash\ndocker compose -p ecc-plugin-debian-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml down --remove-orphans\ndocker compose -p ecc-plugin-ubuntu-test \\\n  -f docker\u002Fplugin-setup\u002Fcompose.yaml down --remove-orphans\n```\n\n## .dockerignore\n\n```\nnode_modules\n.git\n.env\n.env.*\ndist\ncoverage\n*.log\n.next\n.cache\ndocker-compose*.yml\nDockerfile*\nREADME.md\ntests\u002F\n```\n\n## Debugging\n\n### Common Commands\n\n```bash\n# View logs\ndocker compose logs -f app           # Follow app logs\ndocker compose logs --tail=50 db     # Last 50 lines from db\n\n# Execute commands in running container\ndocker compose exec app sh           # Shell into app\ndocker compose exec db psql -U postgres  # Connect to postgres\n\n# Inspect\ndocker compose ps                     # Running services\ndocker compose top                    # Processes in each container\ndocker stats                          # Resource usage\n\n# Rebuild\ndocker compose up --build             # Rebuild images\ndocker compose build --no-cache app   # Force full rebuild\n\n# Clean up\ndocker compose down                   # Stop and remove containers\ndocker compose down -v                # Also remove volumes (DESTRUCTIVE)\ndocker system prune                   # Remove unused images\u002Fcontainers\n```\n\n### Debugging Network Issues\n\n```bash\n# Check DNS resolution inside container\ndocker compose exec app nslookup db\n\n# Check connectivity\ndocker compose exec app wget -qO- http:\u002F\u002Fapi:3000\u002Fhealth\n\n# Inspect network\ndocker network ls\ndocker network inspect \u003Cproject>_default\n```\n\n## Anti-Patterns\n\n```\n# BAD: Using docker compose in production without orchestration\n# Use Kubernetes, ECS, or Docker Swarm for production multi-container workloads\n\n# BAD: Storing data in containers without volumes\n# Containers are ephemeral -- all data lost on restart without volumes\n\n# BAD: Running as root\n# Always create and use a non-root user\n\n# BAD: Using :latest tag\n# Pin to specific versions for reproducible builds\n\n# BAD: One giant container with all services\n# Separate concerns: one process per container\n\n# BAD: Putting secrets in docker-compose.yml\n# Use .env files (gitignored) or Docker secrets\n```\n",{"name":5,"description":7},"main","c32dc0b68600587f78aff3310f3bbd4212173ab3",".kilo\u002Fskills\u002Fdocker-patterns",1,"https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko","https:\u002F\u002Fko-lang.ai.studio","https:\u002F\u002Fgithub.com\u002Flytong760-cell","hanaminikata.com","hello ","2026-11-05 18:26:32",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add lytong760-cell\u002Fcompiler_ko --skill docker-patterns",{"tool":40,"command":41},"bunx","bunx skills add lytong760-cell\u002Fcompiler_ko --skill docker-patterns",{"tool":43,"command":44},"pnpm","pnpm dlx skills add lytong760-cell\u002Fcompiler_ko --skill docker-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fdocker-patterns\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7B36K22Z7155PTGEGTSDNJ4","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fx-api\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7B36HCAE9ESGBVS6J0FR52F","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7B36DYH4ZFJ3GZHPAEMVQAY","workspace-surface-audit","Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fworkspace-surface-audit\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7B36A1QXMEZT8VZMFVQNR5E","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7B364EK3N88VQQJ6HFATJQE","windows-desktop-e2e","E2E testing for Windows native desktop apps (WPF, WinForms, Win32\u002FMFC, Qt) using pywinauto and Windows UI Automation. Use when writing E2E tests for a Windows native desktop app with pywinauto or UI Automation.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fwindows-desktop-e2e\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7B360YF7GGNAF21KT4QB5PG","wayfinder","Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002Flytong760-cell\u002Fcompiler_ko\u002Fblob\u002Fmain\u002F.kilo\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[]]