Docker local dev

From thienanblog/awesome-ai-agent-skills · View interactive version

Docker local dev is an AI agent skill from the GitHub repository thienanblog/awesome-ai-agent-skills. Create or repair local Docker Compose services, Dockerfiles, mounts, networking, and readiness checks. Use when container configuration is the deliverable; ordinary container commands and production deployment are separate concerns.

How to use this skill

Skill file

Docker Local Development

Delegation

Run in the main conversation by default. Delegation can increase usage: obtain explicit approval for the proposed agent count and scope before using subagents. Reuse that approval within its bounds; ask again before expanding the approved count or scope.

Guardrails

Workflow

1. Inspect the project

Run project commands from the target project directory. Resolve bundled helpers through <skill-directory>/scripts/; their location is separate from the project working directory. Check Docker and Compose capabilities before selecting syntax:

docker version
docker compose version

Inspect, when present:

Use stack detection when it adds useful evidence; direct inspection is enough for a known, narrow repair. Resolve the script from this skill directory:

"<skill-directory>/scripts/detect-stack.sh" "<project-root>"

The script emits JSON on stdout and diagnostics on stderr. Confirm uncertain findings from source files without printing secret values.

When Docker is available, optionally inspect local images and networks:

"<skill-directory>/scripts/detect-images.sh"
"<skill-directory>/scripts/detect-network.sh"

Do not let cached images or a detected network override project compatibility or isolation requirements.

2. Resolve the design

Infer and summarize:

Resolve ordinary setup choices from evidence. Ask only when missing information changes the apps in scope, data compatibility, network exposure, or a material replacement not already requested.

3. Load only relevant references

| Need | Read |

|---|---|

| Detection rules and monorepo discovery | references/tech-stack-detection.md |

| Images, processes, dependencies, mounts, environment, Dockerfiles | references/service-configuration-guide.md |

| WordPress, Drupal, or Joomla | references/cms-configuration-guide.md |

| Ports, proxies, domains, networks, host access | references/networking-ports-guide.md |

| Existing Compose or Dockerfile changes | references/merge-backup-strategy.md |

| Readiness checks and smoke tests | references/health-check-patterns.md |

Use assets as starting points, not immutable output. Remove unselected services and adapt placeholders, healthchecks, commands, paths, users, and versions to the detected project.

4. Preview and generate

For a material change to an existing stack, state what will change — files, services and versions, host ports and domains, mount strategy — as part of doing it.

Generate the smallest coherent setup within the existing authorization. Depending on the project that is a dev Dockerfile or build target, .dockerignore, compose.yaml without the obsolete top-level version, the selected proxy or process configuration, and, when configuration is needed, an env example plus an ignored local env file. Add usage notes only when useful or requested.

Prefer:

Run migrations, seeds, CMS installers, destructive cleanup, or database write tests only when authorization covers their data effects. A request to configure containers alone does not imply those actions.

5. Verify

Run static checks first:

docker compose config --quiet
docker build --check .

Use docker build --check only when the installed Docker version supports it. Build and start when the request includes running or verifying the local setup. For file-generation-only requests, keep execution within that narrower scope:

docker compose build
docker compose up -d --wait
docker compose ps -a

If --wait is unavailable, start detached and poll declared healthchecks with a bounded timeout. Inspect logs for failed or restarting services.

Run the bundled checks when applicable:

"<skill-directory>/scripts/health-check.sh"
"<skill-directory>/scripts/db-test.sh"          # connection/read-only query
"<skill-directory>/scripts/db-test.sh" --crud   # explicit temporary-table CRUD check

Also run a stack-specific smoke check such as php artisan about, wp core version, drush status, python manage.py check, or the application's health endpoint. When runtime verification is in scope, verify hot reload with a harmless temporary edit and restore it afterward. Reuse passing checks unless relevant configuration or runtime conditions change.

6. Report

Report:

Never include secret values in the report.

Host Port Registry

Persistent host-port tracking is optional. First check:

PORT_REGISTRY_FILE="${DOCKER_LOCAL_DEV_PORT_REGISTRY:-${XDG_STATE_HOME:-$HOME/.local/state}/docker-local-dev/HOST_PORT_REGISTRY.md}"
test -f "$PORT_REGISTRY_FILE" && sed -n '1,220p' "$PORT_REGISTRY_FILE"

Creating or refreshing a registry scans beyond the current project and records local paths. Establish authorization for the scan root and output path; reuse it if already given. Then run:

node "<skill-directory>/scripts/scan-host-ports.mjs" --root "<approved-root>" --out "$PORT_REGISTRY_FILE" --yes

Treat registered ports as reserved even when no process is currently listening. For a single project without a registry, a live port check is sufficient.

Acceptance Criteria

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.