Claude Skill

docker-basics

Reviews, writes and troubleshoots Dockerfiles and container builds. Use whenever the user shares a Dockerfile or docker-compose file, asks how to containerize an app, shrink an image, speed up builds, stop running as root, handle secrets in images, or debug a container that exits

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download mehranqadirian-skills-devops_docker-basics-c88187d.zip · 6 KB

Install

skills CLI npx skills add https://github.com/MehranQadirian/skills/tree/main/devops/docker-basics
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install mehranqadirian-skills@llmmart
Git git clone https://github.com/MehranQadirian/skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole mehranqadirian/skills collection as a plugin from our marketplace. Git is the plain clone.

README

docker-basics

A Claude skill for reviewing and writing Dockerfiles that are small, safe and fast to rebuild.

What it does

  • Lints a Dockerfile: secrets in ENV/ARG, root user, unpinned or latest base, stale apt-get update, missing -y, cache bloat, ADD, pipe to shell, chmod 777
  • Explains why each finding matters and how to fix it
  • Provides patterns for multi-stage builds, .dockerignore, secrets and pinning
  • Gives a troubleshooting table for containers that exit or cannot be reached

Try it

Review this Dockerfile and make it safer.

My image is 1.5 GB. Why, and how do I shrink it?

My container exits immediately. How do I debug it?

Install

Claude.ai: zip this folder, then go to Settings > Capabilities > Skills > Upload.

Claude Code:

cp -r devops/docker-basics ~/.claude/skills/

Structure

docker-basics/
├── SKILL.md                       skill instructions for Claude
├── scripts/lint_dockerfile.py     Dockerfile linter
└── references/patterns.md         patterns and troubleshooting

Skill manifest

docker-basics

Review a Dockerfile for security, size and build-cache problems, then fix it with patterns that work. The linter reads the file only; it never builds or runs anything.

docker-basics/
├── SKILL.md
├── scripts/
│   └── lint_dockerfile.py     rules for root user, secrets, apt and pip cache, pinning, ADD, pipe-to-shell
└── references/
    └── patterns.md            solid images, multi-stage builds, .dockerignore, secrets, pinning, failures

When to use

  • Writing a Dockerfile for a new app
  • Reviewing an existing Dockerfile before it ships
  • Image too large, builds too slow, container runs as root
  • A secret may have been baked into an image
  • Container exits immediately, cannot be reached, or has file permission errors

Workflow

  1. Lint: python3 scripts/lint_dockerfile.py Dockerfile. Errors need fixing; warnings are likely problems; info is advice. Use --strict to fail on warnings.
  2. Explain each finding in one sentence of why it matters, then show the fix. The most serious are secrets in ENV or ARG, apt-get update alone in a layer, and missing -y.
  3. Apply the patterns from references/patterns.md: pin the base image, copy dependency manifests before the code, combine install and cleanup in one RUN, add a non-root USER, add .dockerignore, use multi-stage builds for compiled output.
  4. Handle secrets properly: runtime environment or build secrets. If a secret was ever committed or baked in, tell the user to rotate it, since deleting a later layer does not remove it from history (see secrets-hygiene).
  5. Re-lint, then give the build and run commands the user should try, and what to expect.
  6. If troubleshooting, ask for docker logs, the exact command, and the host architecture, and use the failure table in the reference.

Rules

  • Never claim an image was built or run unless you ran it; say what you checked and what you did not
  • Prefer a version tag or digest over latest
  • Do not suggest --privileged, chmod 777 or mounting the Docker socket to make an error go away; find the cause
  • One process per container is the default; explain exceptions
  • Keep changes minimal and explain trade-offs (alpine versus slim, size versus compatibility)

What to report back

Field Content
Findings rule, line, severity, why it matters
Fixed Dockerfile with a short comment per change
Not verified build or runtime behavior you could not test
Next steps .dockerignore, health check, secret rotation, CI scan

Related skills

  • github-actions: build and push images in CI safely
  • secrets-hygiene: scan for credentials and respond to leaks
  • linux-troubleshooting: disk, memory and port problems on the host
Files (skills)
  • references
    • patterns.md 3 KB
      Loading…
  • scripts
    • lint_dockerfile.py 6.7 KB
      Loading…
  • README.md 1.1 KB
    # docker-basics
    
    A [Claude skill](../../README.md) for reviewing and writing Dockerfiles that are small, safe and fast to rebuild.
    
    ## What it does
    
    - Lints a Dockerfile: secrets in `ENV`/`ARG`, root user, unpinned or `latest` base, stale `apt-get update`, missing `-y`, cache bloat, `ADD`, pipe to shell, `chmod 777`
    - Explains why each finding matters and how to fix it
    - Provides patterns for multi-stage builds, `.dockerignore`, secrets and pinning
    - Gives a troubleshooting table for containers that exit or cannot be reached
    
    ## Try it
    
    > Review this Dockerfile and make it safer.
    
    > My image is 1.5 GB. Why, and how do I shrink it?
    
    > My container exits immediately. How do I debug it?
    
    ## Install
    
    **Claude.ai:** zip this folder, then go to Settings > Capabilities > Skills > Upload.
    
    **Claude Code:**
    
    ```bash
    cp -r devops/docker-basics ~/.claude/skills/
    ```
    
    ## Structure
    
    ```
    docker-basics/
    ├── SKILL.md                       skill instructions for Claude
    ├── scripts/lint_dockerfile.py     Dockerfile linter
    └── references/patterns.md         patterns and troubleshooting
    ```
    
  • SKILL.md 3.2 KB
    ---
    name: docker-basics
    description: Reviews, writes and troubleshoots Dockerfiles and container builds. Use whenever the user shares a Dockerfile or docker-compose file, asks how to containerize an app, shrink an image, speed up builds, stop running as root, handle secrets in images, or debug a container that exits, cannot be reached or has permission errors, even if they only say "my docker build is slow". Lints with a script, explains each finding and proposes a safer version.
    ---
    
    # docker-basics
    
    Review a Dockerfile for security, size and build-cache problems, then fix it with patterns that work. The linter reads the file only; it never builds or runs anything.
    
    ```
    docker-basics/
    ├── SKILL.md
    ├── scripts/
    │   └── lint_dockerfile.py     rules for root user, secrets, apt and pip cache, pinning, ADD, pipe-to-shell
    └── references/
        └── patterns.md            solid images, multi-stage builds, .dockerignore, secrets, pinning, failures
    ```
    
    ## When to use
    
    - Writing a Dockerfile for a new app
    - Reviewing an existing Dockerfile before it ships
    - Image too large, builds too slow, container runs as root
    - A secret may have been baked into an image
    - Container exits immediately, cannot be reached, or has file permission errors
    
    ## Workflow
    
    1. **Lint**: `python3 scripts/lint_dockerfile.py Dockerfile`. Errors need fixing; warnings are likely problems; info is advice. Use `--strict` to fail on warnings.
    2. **Explain each finding** in one sentence of why it matters, then show the fix. The most serious are secrets in `ENV` or `ARG`, `apt-get update` alone in a layer, and missing `-y`.
    3. **Apply the patterns** from `references/patterns.md`: pin the base image, copy dependency manifests before the code, combine install and cleanup in one `RUN`, add a non-root `USER`, add `.dockerignore`, use multi-stage builds for compiled output.
    4. **Handle secrets properly**: runtime environment or build secrets. If a secret was ever committed or baked in, tell the user to rotate it, since deleting a later layer does not remove it from history (see `secrets-hygiene`).
    5. **Re-lint**, then give the build and run commands the user should try, and what to expect.
    6. **If troubleshooting**, ask for `docker logs`, the exact command, and the host architecture, and use the failure table in the reference.
    
    ## Rules
    
    - Never claim an image was built or run unless you ran it; say what you checked and what you did not
    - Prefer a version tag or digest over `latest`
    - Do not suggest `--privileged`, `chmod 777` or mounting the Docker socket to make an error go away; find the cause
    - One process per container is the default; explain exceptions
    - Keep changes minimal and explain trade-offs (alpine versus slim, size versus compatibility)
    
    ## What to report back
    
    | Field | Content |
    |-------|---------|
    | Findings | rule, line, severity, why it matters |
    | Fixed Dockerfile | with a short comment per change |
    | Not verified | build or runtime behavior you could not test |
    | Next steps | `.dockerignore`, health check, secret rotation, CI scan |
    
    ## Related skills
    
    - `github-actions`: build and push images in CI safely
    - `secrets-hygiene`: scan for credentials and respond to leaks
    - `linux-troubleshooting`: disk, memory and port problems on the host
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.