Agent skill

Dockerfile Best Practices

by 2SSK in 2SSK/dot-files

Docker and container best practices. An agent skill from 2SSK/dot-files.

MITAuto-check passedDevOps & Cloud

Install Dockerfile Best Practices

skills CLI
$ npx skills add 2SSK/dot-files --skill dockerfile-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install 2SSK/dot-files dockerfile-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/2SSK/dot-files.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/dockerfile-best-practices .claude/skills/dockerfile-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
dockerfile-best-practices
GitHub stars
247
Token cost
~438 tokens
SKILL.md length
60 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Docker and container best practices. An agent skill from 2SSK/dot-files.

  • Creating Dockerfiles
  • SKILL.md covers Core Principles, Multi-Stage Builds, Security and Optimization, plus 2 more sections
  • Calls docker, hadolint and trivy
  • Tasks that involve Containers

What it does

Dockerfile Best Practices is an agent skill from 2SSK/dot-files. Docker and container best practices. Multi-stage builds, security, optimization. Use when creating Dockerfiles.

Its SKILL.md is about 440 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: opencode

It sits in DevOps & Cloud, covering Containers. It works with Docker. The licence is MIT.

When your agent uses it

  • Creating Dockerfiles
  • Tasks that involve Containers

Example prompts

  • “/dockerfile-best-practices”

Requirements

  • Docker
  • Compatibility (from SKILL.md): opencode

What it can do on your machine

Read from SKILL.md and the folder at commit 5cab3b1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • docker
    • hadolint
    • trivy

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use docker, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    opencode

    From compatibility in the SKILL.md frontmatter.

Context cost

Dockerfile Best Practices loads about 438 tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 60 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~438

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from 2SSK/dot-files at commit 5cab3b1, republished under its MIT licence (© 2SSK). 60 words, ~438 tokens.

Download SKILL.mdSave it as .claude/skills/dockerfile-best-practices/SKILL.md (or your agent's skills folder).
name
dockerfile-best-practices
description
Docker and container best practices. Multi-stage builds, security, optimization. Use when creating Dockerfiles.
compatibility
opencode

Docker Best Practices

Secure, optimized Dockerfiles for production containers.

Core Principles

  • Small: Minimal layers, minimal size
  • Secure: Non-root user, read-only where possible
  • Fast: Multi-stage builds, layer caching
  • Reproducible: Deterministic builds

Multi-Stage Builds

dockerfile
# Build stage
FROM golang:1.23-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /binary ./cmd/app

# Runtime stage
FROM alpine:3.20
RUN adduser -D -u 1000 appuser
WORKDIR /app

COPY --from=builder /binary /app/app
USER appuser

ENTRYPOINT ["/app/app"]

Security

dockerfile
# Never run as root
USER appuser

# Read-only filesystem (where possible)
# HEALTHCHECK for monitoring
HEALTHCHECK --interval=30s --timeout=3s \
    CMD wget -q --spider http://localhost:8080/healthz || exit 1

Optimization

dockerfile
# Order: least frequently changed → most frequently changed
COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN go build

# This way, go.mod changes trigger cache rebuild, not code changes

Best Practices Checklist

  • Minimal base image (alpine, distroless)
  • Non-root user
  • Multi-stage build
  • No secrets in image
  • Health check defined
  • Labeled metadata
  • Layer caching optimized

Build Commands

bash
# Build
docker build -t app:latest .

# Scan for vulnerabilities
hadolint Dockerfile
trivy image app:latest

# Build with buildkit
DOCKER_BUILDKIT=1 docker build -t app:latest .

© 2SSK, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/dockerfile-best-practices of 2SSK/dot-files.

Open the folder on GitHubat commit 5cab3b1

Compare with similar skills

Dockerfile Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Dockerfile Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dockerfile Best Practices this skill2SSK/dot-files247—~438Automated safety check: PassMIT
Iron Proxy Gateway for NanoClawnanocoai/nanoclaw31k—~4.6kAutomated safety check: NotesMIT
GreptimeDB Dev Docker ImageGreptimeTeam/greptimedb6.7k—~4kAutomated safety check: NotesApache-2.0
Senior DevOps Toolkitmaslennikov-ig/claude-code-orchestrator-kit2606 repos~1.1kAutomated safety check: NotesCustom licence
LangBot Deployment Guidelangbot-app/LangBot18k—~1.2kAutomated safety check: NotesApache-2.0
Build Openshell Mxc WindowsNVIDIA/OpenShell15k—~4.9kAutomated safety check: PassApache-2.0

Similar skills

  • Installs or refreshes Iron Proxy and its Iron Control web console for NanoClaw, with a local Docker setup, database, credentials and a human approval bridge.

    31k GitHub stars~4.6k tokensUpdated 2 days ago
    DevOps & CloudAuto-check: notes
  • GreptimeDB Dev Docker Image

    GreptimeTeam/greptimedb

    Packages a locally built GreptimeDB debug binary into a development-only Docker image for local-cluster testing, with an optional push to a dev registry.

    6.7k GitHub stars~4k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Senior DevOps Toolkit

    maslennikov-ig/claude-code-orchestrator-kit

    Comprehensive DevOps skill for CI/CD, infrastructure automation, containerization, and cloud platforms (AWS, GCP, Azure). Includes pipeline setup…

    260 GitHub starsUsed in 6 repos~1.1k tokens
    DevOps & CloudAuto-check: notes
  • LangBot Deployment Guide

    langbot-app/LangBot

    Deploys and configures a LangBot instance with Docker Compose or Kubernetes, covering config.yaml, the Box sandbox runtime, the plugin runtime and the global API key.

    18k GitHub stars~1.2k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes
  • Official

    Maintain and validate OpenShell's build-only Windows MSVC lane for x64 and ARM64.

    15k GitHub stars~4.9k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Omnigent Docker Compose Deploy

    omnigent-ai/omnigent

    Brings up the Omnigent server and Postgres as a Docker compose stack on any Docker host, and covers the Dockerfile's runtime and host build targets for extending it to a new platform.

    11k GitHub stars~1.3k tokensUpdated today
    DevOps & CloudAuto-check: notes

More from 2SSK/dot-files

  • Cpp Best Practices

    2SSK/dot-files

    C++ development best practices. An agent skill from 2SSK/dot-files.

    247 GitHub stars~489 tokensUpdated 26 days ago
    Auto-check passed
  • Go Best Practices

    2SSK/dot-files

    Go development best practices. An agent skill from 2SSK/dot-files.

    247 GitHub stars~467 tokensUpdated 26 days ago
    Auto-check passed
  • Observability

    2SSK/dot-files

    Observability best practices. An agent skill from 2SSK/dot-files.

    247 GitHub stars~676 tokensUpdated 26 days ago
    Auto-check passed
  • React Native development. An agent skill from 2SSK/dot-files.

    247 GitHub stars~570 tokensUpdated 26 days ago
    Auto-check passed
  • Ship

    2SSK/dot-files

    A skill your agent uses when the user wants to commit, push, and open a pull request for the current changes.

    247 GitHub stars~808 tokensUpdated 26 days ago
    Auto-check: notes
  • TDD

    2SSK/dot-files

    Test-Driven Development workflow. An agent skill from 2SSK/dot-files.

    247 GitHub stars~444 tokensUpdated 26 days ago
    Auto-check passed

Works with

Categories

Questions about Dockerfile Best Practices

What does Dockerfile Best Practices do?

Docker and container best practices. An agent skill from 2SSK/dot-files. Dockerfile Best Practices is an agent skill from 2SSK/dot-files. Docker and container best practices.

When should I use Dockerfile Best Practices?

Dockerfile Best Practices fits situations like: creating Dockerfiles; tasks that involve Containers.

How do I install Dockerfile Best Practices in Claude Code?

Run `npx skills add 2SSK/dot-files --skill dockerfile-best-practices -a claude-code`. Or copy the skill folder (.claude/skills/dockerfile-best-practices in 2SSK/dot-files) into .claude/skills/dockerfile-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Dockerfile Best Practices in Codex?

Run `npx skills add 2SSK/dot-files --skill dockerfile-best-practices -a codex`. Or copy the skill folder (.claude/skills/dockerfile-best-practices in 2SSK/dot-files) into .agents/skills/dockerfile-best-practices in your project. Codex loads it when a task matches its description.

Can I use Dockerfile Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 2SSK/dot-files --skill dockerfile-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dockerfile-best-practices, .gemini/skills/dockerfile-best-practices, .github/skills/dockerfile-best-practices and .opencode/skills/dockerfile-best-practices in your project.

What does Dockerfile Best Practices need to run?

Going by SKILL.md and its folder, Dockerfile Best Practices needs the command-line tools its instructions call (docker, hadolint and trivy). Our summary lists: Docker. Compatibility (from SKILL.md): opencode.

Does Dockerfile Best Practices access the network?

SKILL.md contains no URLs. Its commands use docker, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Dockerfile Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Dockerfile Best Practices use?

Dockerfile Best Practices is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Dockerfile Best Practices use?

About 438 tokens (SKILL.md is roughly 1.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Dockerfile Best Practices?

Skills that share tags, products or a category with Dockerfile Best Practices: Iron Proxy Gateway for NanoClaw (nanocoai/nanoclaw, 31k stars), GreptimeDB Dev Docker Image (GreptimeTeam/greptimedb, 6.7k stars), Senior DevOps Toolkit (maslennikov-ig/claude-code-orchestrator-kit, 260 stars) and LangBot Deployment Guide (langbot-app/LangBot, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dockerfile Best Practices?

2SSK (a GitHub user) maintains it in 2SSK/dot-files, which has 247 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on September 12, 2026.

Source: 2SSK/dot-files on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.