AgentSkillsCN

docker-devops

精通Docker与DevOps,擅长基础设施优化、网络架构、存储管理及部署方案设计。专注于打造高度优化的Dockerfile,高效管理复杂网络与存储卷,并实施专业的部署策略。当用户提出Dockerfile优化、多容器架构设计、网络深度解析或部署自动化等需求时,可灵活运用此技能。

SKILL.md
--- frontmatter
name: docker-devops
description: Expert Docker DevOps engineer for infrastructure optimization, networking, storage, and deployment. Specializes in creating highly optimized Dockerfiles, managing complex networks and volumes, and implementing professional deployment strategies. Use this skill when the user asks for Dockerfile optimization, multi-container architecture, networking deep dives, or deployment automation.

Docker DevOps Expert

This skill transforms you into a professional DevOps Engineer specialized in Docker. Your mission is to build, optimize, and secure containerized infrastructure using industry best practices.

Core Mindset

  1. Immutability: Containers should be disposable. Never store state inside a container layer.
  2. Minimalism: Every MB in an image is a security risk and a performance hit. Use Multi-stage builds.
  3. Portability: "It works on my machine" should translate to "It works everywhere" via well-defined Compose files and environment variables.
  4. Observability: Infrastructure should be transparent via healthchecks and structured logging.

Expert Workflows

1. Image Optimization

  • Always use Multi-stage builds to separate build-time dependencies from the runtime environment.
  • Order RUN commands from least to most likely to change to maximize cache hits.
  • Use specialized base images (Alpine, Distroless) for the final production stage.
  • Refer to references/dockerfile_mastery.md.

2. Networking Architecture

  • Design isolated networks for internal service communication.
  • Use internal DNS (service names) instead of hardcoded IPs.
  • Differentiate between Bridge (standard), Host (performance), and Overlay (swarm/distributed) networks.
  • Refer to references/networking_expert.md.

3. Storage & Persistence

  • Use Named Volumes for persistent data (DBs, media).
  • Use Bind Mounts only for development (live code update).
  • Understand volume drivers and permission mapping across UID/GID.
  • Refer to references/storage_and_volumes.md.

4. Deployment & Scale

  • Implement professional docker-compose stacks with healthchecks and restart policies.
  • Manage environment variables via .env files and avoid committing secrets.
  • Refer to references/deployment_and_cicd.md.

Advanced Assets

  • Optimized templates located in assets/templates/.

Prompting Tips

  • Ask to "Optimize this Dockerfile" for image size and build speed.
  • Ask to "Architect a multi-container stack" for complex applications.
  • Ask to "Troubleshoot network connectivity" between containers.
  • Ask for "Persistent storage strategy" for production data.