containerization

containerization is a cursor rule for Cursor from girijashankarj/cursor-handbook. It costs 443 tokens per session, scanned A, original, MIT.

Container and Docker best practices.

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/girijashankarj/cursor-handbook/containerization
Clone the repo
git clone --depth 1 https://github.com/girijashankarj/cursor-handbook

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 containerization

README.md
[![agentmods](https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/containerization.svg)](https://agentmods.dev/rules/girijashankarj/cursor-handbook/containerization)
Your own site
<a href="https://agentmods.dev/rules/girijashankarj/cursor-handbook/containerization"><img src="https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/containerization.svg" alt="Measured on agentmods" height="20"></a>
Per session 443 This file is loaded in full into every session.
When invoked 443 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin unknown 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.00443 $0.00443
Opus 5 $0.00221 $0.00221
Sonnet 5 $0.00089 $0.00089
Haiku 4.5 $0.00044 $0.00044

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

Security

Grade A, and why

containerization 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 today.

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.

HEALTHCHECK --interval=30s --timeout=3s --start-period=10s CMD wget --spider http://localhost:3000/health || exit 1
.cursor/rules/cloud/containerization.mdc · 55 lines

What it actually says

Containerization Rules

Dockerfile Best Practices

Multi-Stage Build Template

# Stage 1: Dependencies
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json {{CONFIG.techStack.packageManager}}-lock.yaml ./
RUN {{CONFIG.techStack.packageManager}} install --frozen-lockfile

# Stage 2: Build
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN {{CONFIG.techStack.packageManager}} run build

# Stage 3: Production
FROM node:20-alpine AS runner
WORKDIR /app
RUN addgroup --system --gid 1001 appgroup && \
    adduser --system --uid 1001 appuser
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s CMD wget --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/index.js"]

Rules

  • ALWAYS use multi-stage builds for minimal image size
  • ALWAYS run as non-root user in production
  • NEVER use latest tag — pin specific versions
  • ALWAYS include a health check endpoint
  • Use .dockerignore to exclude: node_modules, .git, tests, docs, .env
  • Minimize layers — combine RUN commands where logical
  • Order Dockerfile commands from least to most frequently changed (for cache optimization)
  • Scan images for vulnerabilities before pushing to registry

Docker Compose (Development)

  • Use for local development environment
  • Define all service dependencies (database, cache, queue)
  • Mount source code as volumes for hot reload
  • Use environment files for configuration
  • Include health checks for all services
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. today First seen · 55 lines · 443 tokens per session scan A 2ef45735b1c9

Subscribe to this mod's changes

containerization is a cursor rule published in the GitHub repository girijashankarj/cursor-handbook (30 stars, last pushed 3d ago), licensed MIT. It adds 443 tokens to every session, about $0.0022 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.