agentleFS
sordi-aisordi-ai/skill-everything/skills/docker/SKILL.md

docker

Skill20 starsChanged 7 months agoMITView on GitHub

Apply when writing or reviewing Dockerfiles, docker compose files, or container build pipelines. Covers layer caching, multi-stage builds, security hardening, and compose conventions.

47 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ansible, kubernetes and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • KubementatSkill

    ansible

    Ansible automation reference for playbooks, roles, inventory, variables, and modules. Includes Proxmox VE and Docker integration via community.general and community.docker collections. Use when writing playbooks, troubleshooting Ansible runs, or designing automation workflows. Triggers: ansible, playbook, inventory, role, task, handler, vars, jinja2, galaxy, proxmox_kvm, proxmox_lxc, docker_container, docker_compose.

    Also in 3 projects that use this

  • mjunaidcaSkill

    kubernetes

    Production-grade Kubernetes manifests and debugging for containerized applications. This skill should be used when users ask to deploy to Kubernetes, create K8s manifests, containerize for K8s, set up Deployments/Services/Jobs/StatefulSets/CronJobs, create namespaces with resource quotas, set up multi-team isolation, configure ResourceQuota/ LimitRange, secure with RBAC (ServiceAccount, Role, RoleBinding), configure init containers (model download, db wait, migrations), set up sidecars (logging, metrics), or debug pods (CrashLoopBackOff, logs, exec, describe, events). Auto-detects from Dockerfile/code, generates hardened manifests with educational comments. CKAD-aligned.

    Also in 6 projects that use this

  • mjunaidcaSkill

    helm

    Production-grade Helm 4 chart development, release management, and debugging. This skill should be used when users ask to create Helm charts, deploy with Helm, manage releases (install/upgrade/rollback), push charts to OCI registries, debug failed deployments, configure chart dependencies, create umbrella charts, set up GitOps with ArgoCD/Flux, or troubleshoot Helm issues. Auto-detects from Dockerfile/code, generates production-hardened charts with library patterns. Complements kubernetes skill.

    Also in 3 projects that use this

  • diego-tobalinaSkill

    logging

    Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.

    Also in 4 projects that use this

  • ihiteshguptaSkill

    terraform

    Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.

    Also in 4 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 4 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 4 are distinctive, and 13 are very specific to this project.

  • 0

    Common

    Most of the 42 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 13

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Dependency layer first: Always install dependencies in a separate layer before copying application source, so a source change does not …

    line 26
  2. Very specific:

    Copy only what's needed early: Before copying the full source tree, copy only the dependency manifest files (e.g., requirements.txt, …

    line 27
  3. Very specific:

    Minimise layer count: Prefer chaining related RUN commands with && and \ continuations rather than issuing one RUN per command.

    line 28
  4. Distinctive:

    Order by change frequency: Always place instructions that change rarely (OS packages, global tools) before instructions that change often …

    line 29
  5. Distinctive:

    Use multi-stage for compiled artefacts: Always use a builder stage to compile or bundle, then copy only the final artefact into a minimal …

    line 33
  6. Very specific:

    Name every stage: Use AS <name> on every FROM line so later stages and docker build --target calls are readable and stable.

    line 34
  7. Very specific:

    Pin the runtime base image: Always pin base images to a specific digest or immutable tag (e.g., python:3.12.3-slim) in the runtime stage.

    line 35
  8. Very specific:

    Run as non-root: Always create a dedicated non-root user and switch to it with USER before the final CMD/ENTRYPOINT.

    line 39
  9. Very specific:

    Never embed secrets in image layers: Never pass secrets via ARG or ENV in a Dockerfile.

    line 40
  10. Very specific:

    Scan images before push: Before pushing any image to a registry, run an image vulnerability scanner (e.g., trivy image, docker scout) and …

    line 41
  11. Very specific:

    Prefix docker run -v from Git Bash with MSYS_NO_PATHCONV=1: Always prefix docker run -v calls issued from Git Bash or MSYS on Windows with …

    line 42
  12. Very specific:

    Maintain a .dockerignore: Always keep a .dockerignore at the repo root that excludes .git, test fixtures, local env files, and build …

    line 46
  13. Very specific:

    Declare a HEALTHCHECK: Always add a HEALTHCHECK instruction so orchestrators (Compose, Kubernetes) can detect unhealthy containers without …

    line 50
  14. Very specific:

    Use exec-form ENTRYPOINT: Always write ENTRYPOINT in exec form (["executable", "arg"]) rather than shell form so the process receives OS …

    line 51
  15. Very specific:

    Set resource limits in compose: Always declare deploy.resources.limits (CPU and memory) for every service in docker-compose.yml to prevent …

    line 55
  16. Very specific:

    Use compose profiles for optional services: Prefer assigning optional services (e.g., observability stacks, seed jobs) to named profiles so …

    line 56
  17. Distinctive:

    Isolate networks per stack: Avoid using the default bridge network across unrelated stacks.

    line 57

“Common” is measured: kept by at least 6 in 10 of the 42 edited versions of this file we could read. “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

Sub-Skill: Docker / Container Conventions

Purpose: Prevent common container mistakes — busted layer caches, bloated images, insecure defaults, and compose misconfigurations — before they reach CI or production.


Rules

Layer Ordering & Cache

  1. Dependency layer first. Always install dependencies in a separate layer before copying application source, so a source change does not invalidate the package cache. Reference: ERR-2026-020
  2. Copy only what's needed early. Before copying the full source tree, copy only the dependency manifest files (e.g., requirements.txt, package.json, pyproject.toml) so the install layer is cached independently.
  3. Minimise layer count. Prefer chaining related RUN commands with && and \ continuations rather than issuing one RUN per command; each RUN creates a new layer.
  4. Order by change frequency. Always place instructions that change rarely (OS packages, global tools) before instructions that change often (app source, config files).

Multi-Stage Builds

  1. Use multi-stage for compiled artefacts. Always use a builder stage to compile or bundle, then copy only the final artefact into a minimal runtime stage; never ship build toolchains in the production image.
  2. Name every stage. Use AS <name> on every FROM line so later stages and docker build --target calls are readable and stable.
  3. Pin the runtime base image. Always pin base images to a specific digest or immutable tag (e.g., python:3.12.3-slim) in the runtime stage; never use latest in production Dockerfiles.

Security

  1. Run as non-root. Always create a dedicated non-root user and switch to it with USER before the final CMD/ENTRYPOINT; never run application processes as root inside a container.
  2. Never embed secrets in image layers. Never pass secrets via ARG or ENV in a Dockerfile; use Docker BuildKit --secret mounts or runtime environment injection instead.
  3. Scan images before push. Before pushing any image to a registry, run an image vulnerability scanner (e.g., trivy image, docker scout) and fail the pipeline on critical CVEs.
  4. Prefix docker run -v from Git Bash with MSYS_NO_PATHCONV=1. Always prefix docker run -v calls issued from Git Bash or MSYS on Windows with MSYS_NO_PATHCONV=1 to prevent path mangling. Reference: ERR-2026-013

.dockerignore & Context

  1. Maintain a .dockerignore. Always keep a .dockerignore at the repo root that excludes .git, test fixtures, local env files, and build artefacts; a large build context slows every build and may leak secrets.

Health Checks & Signal Handling

  1. Declare a HEALTHCHECK. Always add a HEALTHCHECK instruction so orchestrators (Compose, Kubernetes) can detect unhealthy containers without external probes.
  2. Use exec-form ENTRYPOINT. Always write ENTRYPOINT in exec form (["executable", "arg"]) rather than shell form so the process receives OS signals directly and docker stop terminates it cleanly.

Compose Conventions

  1. Set resource limits in compose. Always declare deploy.resources.limits (CPU and memory) for every service in docker-compose.yml to prevent a runaway container from starving the host.
  2. Use compose profiles for optional services. Prefer assigning optional services (e.g., observability stacks, seed jobs) to named profiles so docker compose up starts only the core services by default.
  3. Isolate networks per stack. Avoid using the default bridge network across unrelated stacks; define explicit named networks and attach only the services that need to communicate.

See also

  • skills/code-quality/SKILL.md — general layering and change-frequency ordering principles
  • skills/review-deployment/SKILL.md — deployment checklist that includes image scanning and migration ordering

Notes

  • ERR-2026-020 is the canonical reference for layer-cache busting caused by copying source before installing dependencies.
  • ERR-2026-013 covers MSYS path mangling on Windows when using docker run -v.

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.