agentleFS
SwastikPandey1024SwastikPandey1024/agentic-engineering-os/.agents/skills/docker/SKILL.md

docker

Skill1 starsChanged 3 months agoMITView on GitHub

Production-grade containerization, multi-stage Dockerfiles, non-root user execution, docker-compose orchestration, and health checks.

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

55 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ml-training-recipe, replication and 10 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.
  • getcompanion-aiSkill

    ml-training-recipe

    Find implementable ML training recipes from papers, datasets, docs, and code. Use when the user wants to fine-tune, train, reproduce, or choose a practical ML method, dataset, hyperparameter setup, or benchmark recipe.

    Also in 3 projects that use this

  • getcompanion-aiSkill

    replication

    Plan a replication of a paper, claim, or benchmark, and execute only after an explicit environment choice. Use when the user asks to replicate results, reproduce an experiment, verify a claim empirically, or build a replication package.

    Also in 3 projects that use this

  • Sorcha-PlatformSkill

    scalar

    Generates and configures Scalar OpenAPI UI for API documentation. Use when: Adding API documentation to services, configuring OpenAPI endpoints, customizing documentation themes

    Also in 3 projects that use this

  • brainbytes-devSkill

    alpha-research

    Also in 3 projects that use this

  • JaimeParkerSkill

    paper-code-audit

    Perform three-way cross-validation of a research paper by comparing the original paper text (via Zotero), official code implementation (via Git), and personal Obsidian notes. Use this skill whenever the user wants to "audit a paper", "verify paper claims against code", "cross-check notes with implementation", "triangulate paper + code + notes", "find discrepancies between paper and code", or mentions wanting a deep, structured comparison of a paper's claims against its implementation and their own notes. Also trigger when the user asks to "analyze this paper thoroughly" with code available, or when they want to systematically reconcile what the paper says, what the code does, and what their notes claim.

    Also in 3 projects that use this

  • Sorcha-PlatformSkill

    redis

    Implements Redis caching, session management, and distributed coordination for the Sorcha platform. Use when: Adding caching layers, token revocation, rate limiting, SignalR backplane, or distributed state.

    Also in 5 projects that use this

  • +1 more from getcompanion-ai

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 47 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 10
  2. Very specific:

    NEVER run pip install without --no-cache-dir: Avoid inflating image size with cached wheel downloads.

    line 163

“Common” is measured: kept by at least 6 in 10 of the 47 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

Docker Skill

1. When Should I Use This?

Use this skill when:

  • Creating or optimizing Dockerfile and docker-compose.yml configurations for backend, frontend, or ML services.
  • Implementing multi-stage builds to minimize container image sizes and eliminate build tools from runtime images.
  • Setting up container healthchecks, non-root security contexts, and .dockerignore files.
  • Running and debugging local multi-service container environments.

2. What Should I Inspect First?

  1. Service Runtime & Dependencies:
    • Python: Requires system C-libraries? (e.g. libgomp1, ffmpeg, libgl1 for OpenCV/PaddleOCR).
    • Frontend: Node build step vs static file server (Nginx/Caddy).
  2. Environment Variables: Inspect .env.example for required runtime variables and database hostnames.
  3. Port Mappings & Health Endpoints: Identify HTTP listening ports and health check endpoints (e.g. /api/v1/health or /ready).

3. What Workflow Should I Follow?

Create .dockerignore (Exclude .venv, node_modules, .git, datasets)
                  ↓
Write Multi-Stage Dockerfile (Builder Stage → Runtime Stage)
                  ↓
Configure Non-Root User & Working Directory
                  ↓
Define HEALTHCHECK Instruction
                  ↓
Configure docker-compose.yml (Environment, Ports, Volumes, Depends_on)
                  ↓
Build & Test Container Locally (Run smoke tests against exposed port)

Production Multi-Stage Python Backend Dockerfile

# Dockerfile.backend
# ==========================================
# Stage 1: Build stage
# ==========================================
FROM python:3.12-slim AS builder

WORKDIR /build

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

COPY pyproject.toml requirements.txt ./
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt

# ==========================================
# Stage 2: Minimal Runtime stage
# ==========================================
FROM python:3.12-slim AS runner

WORKDIR /app

# Install minimal runtime system libraries (e.g., for OpenCV/OCR)
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgomp1 \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy installed Python packages from builder
COPY --from=builder /install /usr/local

# Create non-root user
RUN useradd -m -u 1000 appuser && \
    chown -R appuser:appuser /app

# Copy application source code
COPY --chown=appuser:appuser app/ ./app/

USER appuser

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PORT=8000

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:8000/api/v1/health || exit 1

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

Multi-Stage React Frontend Dockerfile with Nginx

# Dockerfile.frontend
# ==========================================
# Stage 1: Build React SPA
# ==========================================
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# ==========================================
# Stage 2: Serve via Nginx Unprivileged
# ==========================================
FROM nginx:alpine-slim
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]

Mandatory .dockerignore

.git
.github
.venv
venv
__pycache__
*.pyc
node_modules
dist
build
datasets/raw
datasets/processed
ml/artifacts/*.pt
*.log
.env
.env.local
.pytest_cache
.coverage

4. What Decisions Should I Make?

StrategyRecommendation
Base ImageAlways use -slim (Debian) or -alpine for minimal surface area and fast pull times.
Security UserNever run containers as root in production. Always create and switch to a non-root appuser.
Signal HandlingUse exec form for CMD (CMD ["uvicorn", ...]), ensuring PID 1 receives SIGTERM and SIGINT cleanly.
Data PersistenceMount persistent storage (e.g. SQLite databases, uploaded PDFs, FAISS indexes) using named Docker volumes.

5. What Should I Avoid?

  • NEVER copy .env into the Docker image: Environment variables must be injected at container runtime.
  • NEVER run pip install without --no-cache-dir: Avoid inflating image size with cached wheel downloads.
  • NEVER omit .dockerignore: Sending huge .git/ and dataset folders as build context slows down builds significantly.
  • NEVER use latest tag in production base images: Pin major/minor versions (e.g. python:3.12-slim, node:20-alpine).

6. How Should I Verify Success?

# 1. Build container image
docker build -t my-app:test -f Dockerfile.backend .

# 2. Run container in detached mode
docker run -d --name test-container -p 8000:8000 --env-file .env.example my-app:test

# 3. Verify health status and logs
docker ps --filter "name=test-container"
docker logs test-container

# 4. Smoke test exposed HTTP port
curl -i http://localhost:8000/api/v1/health

# 5. Clean up
docker stop test-container && docker rm test-container

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.