home / skills / partme-ai / full-stack-skills / docker

docker skill

/skills/docker

This skill guides you through creating Docker containers, building images, and managing containerized apps with practical, step-by-step tips.

npx playbooks add skill partme-ai/full-stack-skills --skill docker

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
674 B
---
name: docker
description: Provides comprehensive guidance for Docker including container creation, images, Dockerfile, docker-compose, and container management. Use when the user asks about Docker, needs to create Docker containers, build Docker images, or manage containerized applications.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]

Overview

This skill provides practical, hands-on guidance for working with Docker: creating containers, building and optimizing images, writing Dockerfiles, and orchestrating multi-container apps with docker-compose. It focuses on actionable steps, common commands, and patterns to containerize applications reliably for development and production. Use it to speed up container workflows and troubleshoot container lifecycle issues.

How this skill works

The skill inspects your goals and environment, then recommends Docker commands, Dockerfile patterns, and docker-compose configurations tailored to the application type (web service, database, worker, etc.). It helps you build lean images, manage volumes and networks, set up environment variables and secrets, and suggests debugging techniques for logs, container health, and networking. It also offers migration tips for moving from local containers to production-ready deployments.

When to use it

  • You need to containerize a new or existing application (create Dockerfile and image).
  • You want to compose multiple services (web, db, cache) using docker-compose.
  • You need to optimize image size, build caching, or multistage builds for CI pipelines.
  • You are troubleshooting container startup failures, networking, or persistent storage.
  • You plan to run containers in development, CI, or prepare for production deployment.

Best practices

  • Use multistage builds to keep final images small and avoid shipping build tools.
  • Pin base image versions and use minimal base images (alpine, distroless) when appropriate.
  • Keep Dockerfiles declarative and cache-friendly: order layers by volatility.
  • Store persistent data in named volumes and avoid baking secrets into images.
  • Use healthchecks and explicit user/run commands to improve container reliability.

Example use cases

  • Create a Dockerfile for a Python Flask app with a venv, requirements, and gunicorn entrypoint.
  • Compose a local stack with app, Postgres, and Redis, and wire networks and volumes.
  • Write a CI pipeline step that builds, tags, and pushes a production image with cached layers.
  • Diagnose a container that crashes on startup using docker logs, inspect, and exec.
  • Migrate a legacy deployment to containers by packaging each service as a separate image.

FAQ

How do I reduce my image size?

Use multistage builds, choose minimal base images, remove build artifacts, and combine RUN steps to reduce layers.

Where should I store secrets?

Avoid embedding secrets in images. Use environment variables, Docker secrets, or an external secrets manager at runtime.

When should I use docker-compose vs Kubernetes?

Use docker-compose for local development and simple stacks. Move to Kubernetes for production-scale orchestration, advanced scheduling, and multi-node clusters.