agentleFS
mdayan8mdayan8/docker-containers/SKILL.md

docker-containers

Skill0 starsChanged 8 months agoMITView on GitHub

Build, repair, and harden Docker-based development and deployment setups for applications and services. Use when any agent needs to create or update `Dockerfile`, `.dockerignore`, `compose.yaml` or `docker-compose.yml`, container entrypoints, multi-stage builds, local service orchestration, or container debugging workflows. Trigger for requests such as containerizing a Node/Python/Go app, adding Postgres or Redis with Compose, shrinking images, fixing container startup failures, debugging port or volume issues, improving Docker caching, or making a container setup safer for production.

  • Reads credentials

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. jornalistainclusivo/jinc-skills★ 198% same

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

36 rules. About 0 are common, 27 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈27

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to move from "make this run in Docker" to a working, debuggable setup with sane defaults.

    line 10
  2. Very specific:

    No container files yet: create Dockerfile, .dockerignore, and optionally compose.yaml.

    line 18
  3. Distinctive:

    Read the app before editing container files:

    line 26
  4. Very specific:

    Check whether the app needs build output before runtime, such as TypeScript, Next.js, Vite, or compiled binaries.

    line 30
  5. Very specific:

    Check for local-only assumptions that break in containers, especially hardcoded localhost, file paths, and missing bind addresses.

    line 32
  6. Distinctive:

    If the stack-specific pattern is not obvious, read recipes.md.

    line 34
  7. Very specific:

    Add a .dockerignore before broad COPY steps to keep build context small.

    line 41
  8. Distinctive:

    Use multi-stage builds when the runtime does not need compilers, package managers, or source files.

    line 43
  9. Distinctive:

    Use one process per container unless the user explicitly wants a process supervisor.

    line 49
  10. Very specific:

    Use exec-form CMD and ENTRYPOINT.

    line 51
  11. Distinctive:

    Keep build steps deterministic and avoid shell tricks unless required by the app.

    line 52
  12. Distinctive:

    Use Compose when the app needs supporting services or a repeatable local workflow.

    line 56
  13. Very specific:

    Use service names for container-to-container hostnames, not localhost.

    line 67
  14. Distinctive:

    Add healthchecks when startup ordering matters.

    line 69
  15. Very specific:

    Prefer depends_on plus healthchecks over sleep-based startup hacks.

    line 70
  16. Distinctive:

    Keep dev-oriented bind mounts out of production examples unless the user asks for dev containers specifically.

    line 71
  17. Distinctive:

    Read the container files and start command.

    line 77
  18. Distinctive:

    Check whether the service listens on the expected port and address.

    line 78
  19. Distinctive:

    Check env vars, working directory, file permissions, and executable paths.

    line 80
  20. Distinctive:

    Verify inter-service networking and DNS names under Compose.

    line 81
  21. Distinctive:

    Verify readiness issues separately from simple startup failures.

    line 82
  22. Distinctive:

    If the failure pattern matches a known Docker issue, read troubleshooting.md.

    line 92
  23. Distinctive:

    Use multi-stage builds for compiled or bundled applications.

    line 98
  24. Distinctive:

    Keep images minimal and omit dev-only tooling from runtime layers.

    line 99
  25. Very specific:

    Avoid latest tags in examples when a major version is known.

    line 100
  26. Very specific:

    Avoid copying .env files or secrets into the image.

    line 101
  27. Distinctive:

    Prefer a non-root user in the runtime stage when file permissions allow it.

    line 102
  28. Distinctive:

    Keep writable paths explicit.

    line 103
  29. Distinctive:

    Document required runtime env vars instead of hardcoding them.

    line 104
  30. Distinctive:

    Do not add Kubernetes, reverse proxies, or process supervisors unless the task actually needs them.

    line 108
  31. Distinctive:

    Do not invent healthchecks, workers, or sidecars without evidence in the app.

    line 109
  32. Distinctive:

    Do not replace the application's package manager or framework conventions just to make the Dockerfile look cleaner.

    line 110
  33. Distinctive:

    Before finishing, verify that:

    line 114
  34. Distinctive:

    Read examples.md for concrete starter Dockerfile and Compose patterns.

    line 125
  35. Distinctive:

    Read recipes.md for starter patterns by stack.

    line 126
  36. Distinctive:

    Read troubleshooting.md for common failure modes and fixes.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Docker Containers

Overview

Use this skill to move from "make this run in Docker" to a working, debuggable setup with sane defaults. Prefer small, reviewable changes and preserve the app's current run behavior unless the user asks to change it.

For concrete starter patterns, read examples.md.

Workflow Decision Tree

Choose the path that matches the request:

  • No container files yet: create Dockerfile, .dockerignore, and optionally compose.yaml.
  • Existing Docker setup is broken: inspect the current files first, then fix the smallest root cause.
  • Local multi-service dev is needed: add or repair compose.yaml with app, database, cache, and named volumes as needed.
  • Image is too large or slow: convert to multi-stage builds, tighten copy patterns, and improve cache layering.
  • Production safety is requested: run as non-root when practical, set explicit ports and env handling, and avoid baking secrets into images.

Gather Context First

Read the app before editing container files:

  • Detect the runtime and package manager from existing files such as package.json, pyproject.toml, requirements.txt, go.mod, Gemfile, or framework config.
  • Find the real start command from scripts, docs, or the current process manager.
  • Check whether the app needs build output before runtime, such as TypeScript, Next.js, Vite, or compiled binaries.
  • Identify external dependencies such as PostgreSQL, Redis, queues, object storage, or headless browsers.
  • Check for local-only assumptions that break in containers, especially hardcoded localhost, file paths, and missing bind addresses.

If the stack-specific pattern is not obvious, read recipes.md.

Containerize an App

Follow this order:

  1. Pick a small, official base image that matches the runtime version already used by the project.
  2. Add a .dockerignore before broad COPY steps to keep build context small.
  3. Copy dependency manifests first, install dependencies, then copy the rest of the source to preserve cache hits.
  4. Use multi-stage builds when the runtime does not need compilers, package managers, or source files.
  5. Expose only the application port actually used by the service.
  6. Set the startup command to match the existing app behavior.

Prefer these defaults:

  • Use one process per container unless the user explicitly wants a process supervisor.
  • Bind servers to 0.0.0.0, not 127.0.0.1.
  • Use exec-form CMD and ENTRYPOINT.
  • Keep build steps deterministic and avoid shell tricks unless required by the app.

Add Compose for Local Development

Use Compose when the app needs supporting services or a repeatable local workflow.

Include:

  • one service for the app
  • one service per dependency such as db, redis, or worker
  • named volumes for persistent local state when data durability matters
  • env file wiring only if the project already uses it or the user wants it

Compose rules:

  • Use service names for container-to-container hostnames, not localhost.
  • Map only the ports needed on the host machine.
  • Add healthchecks when startup ordering matters.
  • Prefer depends_on plus healthchecks over sleep-based startup hacks.
  • Keep dev-oriented bind mounts out of production examples unless the user asks for dev containers specifically.

Debug Failing Containers

Work from symptoms to root cause:

  1. Read the container files and start command.
  2. Check whether the service listens on the expected port and address.
  3. Confirm required files are copied into the image.
  4. Check env vars, working directory, file permissions, and executable paths.
  5. Verify inter-service networking and DNS names under Compose.
  6. Verify readiness issues separately from simple startup failures.

Common fixes:

  • Port works locally but not in Docker: bind to 0.0.0.0.
  • Build is slow: reorder layers so dependency install happens before source copy.
  • Runtime cannot find files: fix WORKDIR, COPY, or build output path.
  • App cannot reach database: use the Compose service name instead of localhost.
  • Container exits immediately: fix the command, foreground process, or missing env vars.

If the failure pattern matches a known Docker issue, read troubleshooting.md.

Production-Safe Defaults

Apply these by default unless they conflict with the app:

  • Use multi-stage builds for compiled or bundled applications.
  • Keep images minimal and omit dev-only tooling from runtime layers.
  • Avoid latest tags in examples when a major version is known.
  • Avoid copying .env files or secrets into the image.
  • Prefer a non-root user in the runtime stage when file permissions allow it.
  • Keep writable paths explicit.
  • Document required runtime env vars instead of hardcoding them.

Do not over-engineer:

  • Do not add Kubernetes, reverse proxies, or process supervisors unless the task actually needs them.
  • Do not invent healthchecks, workers, or sidecars without evidence in the app.
  • Do not replace the application's package manager or framework conventions just to make the Dockerfile look cleaner.

Output Checklist

Before finishing, verify that:

  • container files match the actual app runtime
  • ports, env vars, and service hostnames are coherent
  • build layers are cache-friendly
  • the startup command matches the existing app behavior
  • the setup distinguishes local dev concerns from production concerns
  • the final result includes a short usage example such as docker build, docker run, or docker compose up

References

  • Read examples.md for concrete starter Dockerfile and Compose patterns.
  • Read recipes.md for starter patterns by stack.
  • Read troubleshooting.md for common failure modes and fixes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.