docker

A set of rules for writing Dockerfiles, Docker Compose files, and container build pipelines. Containers package software and its dependencies so it can run consistently across environments.

In plain words
What is it for?
Use it when reviewing or creating container builds, including dependency caching, multi-stage builds, and runtime image setup.
Why use it?
It helps avoid slow rebuilds, unnecessarily large container images, insecure defaults, and incorrect Compose setups.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/sordi-ai/skill-everything/docker
Clone the repo
git clone --depth 1 https://github.com/sordi-ai/skill-everything

Made for: Cursor.

Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 975 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00033 $0.00975
Opus 5 $0.00016 $0.00487
Sonnet 5 $0.00007 $0.00195
Haiku 4.5 $0.00003 $0.00097

Measured 2d ago against content hash 76d6bf20fab6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/docker.mdc · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 62 lines · 33 tokens per session scan A 76d6bf20fab6

Subscribe to this mod's changes

docker is a cursor rule published in the GitHub repository sordi-ai/skill-everything (19 stars, last pushed 3mo ago), licensed MIT. It adds 33 tokens to every session and 975 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.