docker

Generate and optimize Dockerfiles and docker-compose configurations with security best practices.

53|1|Updated Dec 18, 2025
One-click install
npx skills add https://github.com/cosmix/claude-code-setup --skill docker-cosmix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker
Source: https://github.com/cosmix/claude-code-setup/tree/main/skills/docker
Command: npx skills add https://github.com/cosmix/claude-code-setup --skill docker-cosmix

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides building lean, secure Dockerfiles, crafting robust multi-container setups, and applying best practices for container security and performance.

Core Features & Use Cases

  • Efficient Dockerfiles: Multi-stage builds, minimal base images, and non-root users.
  • Compose & Orchestration: Compose files with service dependencies and persistence.
  • Security & Compliance: Secrets handling, vulnerability scanning, and image hygiene.

Quick Start

Create a production-ready Dockerfile for a Python app using a 2-stage build and a non-root user.

Frequently Asked Questions about docker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write an efficient Dockerfile with multi-stage builds?

Multi-stage builds reduce final image size by separating compilation from runtime. Use multiple FROM statements to build in one stage and copy only necessary artifacts to the final stage, eliminating build dependencies and keeping images lean for production deployment.

What's the best way to handle secrets in Docker containers?

Secrets handling in Docker avoids hardcoding credentials in images. Use Docker secrets for swarm mode, environment variables from external files, or bind mounts to inject sensitive data at runtime without exposing them in image layers or logs.

How do I set up multi-container applications with docker-compose?

Docker-compose orchestrates multiple containers by defining services, dependencies, volumes, and networking in a single YAML file. Specify service configurations, link containers, mount persistent storage, and manage startup order for robust multi-container setups.

Why should I run containers as non-root users?

Running containers as non-root users limits damage from compromised applications by restricting file system and system access. This security practice prevents privilege escalation and reduces attack surface in development, staging, and production environments.

Can I integrate Docker builds into CI/CD pipelines?

Yes, Docker integrates with CI/CD pipelines to automate image building, testing, and pushing to registries. Automated pipelines ensure consistent image production, apply security scanning, and streamline deployment across environments.

What base images should I choose for minimal container size?

Minimal base images like Alpine, Distroless, or scratch reduce image size and attack surface. Choose based on your application runtime requirements—Alpine for general use, Distroless for compiled languages, scratch for static binaries—balancing size against included utilities.