Docker-guidelines

Docker-guidelines is a cursor rule for Cursor from AhmedAbouelkher/micro_market. It costs 0 tokens per session (1,836 once invoked), scanned A, a copy of docker, MIT.

A set of rules for writing Dockerfiles and Docker Compose configurations. Docker packages applications into isolated containers, while Compose describes multi-container setups.

In plain words
What is it for?
It guides multi-stage builds, dependency selection, runtime-image creation, non-root execution, and related Docker configuration decisions.
Why use it?
It helps make container builds smaller, safer, repeatable, and easier to maintain.

Cursor rule for Cursor

Written for Cursor: installed under .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/ahmedabouelkher/micro_market/docker-guidelines
Clone the repo
git clone --depth 1 https://github.com/AhmedAbouelkher/micro_market

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Docker-guidelines

README.md
[![agentmods](https://agentmods.dev/badge/rules/ahmedabouelkher/micro_market/docker-guidelines.svg)](https://agentmods.dev/rules/ahmedabouelkher/micro_market/docker-guidelines)
Your own site
<a href="https://agentmods.dev/rules/ahmedabouelkher/micro_market/docker-guidelines"><img src="https://agentmods.dev/badge/rules/ahmedabouelkher/micro_market/docker-guidelines.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,836 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.1 $0.00000 $0.01836
Opus 5 $0.00000 $0.00918
Sonnet 5 $0.00000 $0.00367
Haiku 4.5 $0.00000 $0.00184

Measured 5d ago against content hash 3d2d59563ee9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

Docker-guidelines scanned grade A with 1 finding 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 5d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

CMD curl -f http://localhost:3000/health || exit 1
Origin

This is a copy

100% identical to docker — 21 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/Docker-guidelines.mdc · 268 lines

How it starts

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

docker Best Practices

Docker is the cornerstone of modern container-first development. Treat your Dockerfile and docker-compose.yml as critical source code. These rules ensure your images are fast, secure, reproducible, and aligned with modern DevOps practices.

1. Optimize for Multi-Stage Builds

Always use multi-stage builds. This pattern isolates build-time dependencies from runtime, drastically reducing final image size and attack surface.

❌ BAD: Single-stage build with all dependencies

FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
CMD ["node", "dist/server.js"]

✅ GOOD: Multi-stage build for production

# Stage 1: Build application artifacts
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production # Install only production dependencies for build
COPY . .
RUN npm run build

# Stage 2: Create minimal runtime image
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules # Copy only necessary runtime modules
USER node # Run as non-root user
EXPOSE 3000
CMD ["node", "dist/server.js"]

2. Choose Minimal, Trusted Base Images

Start with the smallest possible base image from a trusted source (Docker Official Images, Verified Publishers). Alpine variants are often the best choice for minimal footprints.

❌ BAD: Large, generic base image

FROM ubuntu:latest # Too large, many unnecessary packages and vulnerabilities

✅ GOOD: Minimal, specific base image

FROM node:20-alpine # Official, small, specific to Node.js
# Or for static content:
FROM nginx:alpine

3. Leverage .dockerignore

Always use a .dockerignore file to exclude irrelevant files and directories from your build context. This significantly speeds up builds and prevents sensitive or unnecessary files from being copied into the image.

❌ BAD: No .dockerignore (sends node_modules, .git, .env, etc., to the daemon)

Read the full file on GitHub · 268 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. 5d ago First seen · 268 lines · 1,836 tokens per session scan A 3d2d59563ee9

Subscribe to this mod's changes

Docker-guidelines is a cursor rule published in the GitHub repository AhmedAbouelkher/micro_market (2 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,836 tokens. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to docker, differing in 21 lines, and is treated as a copy.