Docker Management 标志

Docker Management

社区
AlexAI-MCP
docker-management

Manage Docker containers, images, volumes, networks, and Compose stacks - lifecycle ops, debugging, cleanup, and Dockerfile optimization.

Add to TypingMind

概览

发布者AlexAI-MCP
代码仓库hermes-CCC
技能名称docker-management
星标数
134
复刻数
22
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 AlexAI-MCP 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Docker Management AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/docker-management
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AlexAI-MCP/hermes-CCC.git /tmp/hermes-CCC
mkdir -p .claude/skills
cp -r /tmp/hermes-CCC/skills/docker-management .claude/skills/docker-management
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Docker Management,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Docker Management。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Docker Management 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Docker Management

Purpose

  • Use this skill to run, inspect, debug, and clean up Docker workloads.
  • Prefer it when the task involves containers, images, networks, volumes, or Compose stacks.
  • This skill covers both day-to-day lifecycle operations and practical debugging patterns.

Core Mental Model

  • Images are immutable build artifacts.
  • Containers are running or stopped instances of images.
  • Volumes persist data outside the container filesystem lifecycle.
  • Networks define service-to-service connectivity.
  • Compose describes multi-container applications declaratively.

Container Lifecycle

  • Create and run a container.
  • Start a stopped container.
  • Stop a running container.
  • Restart a container after config or dependency issues.
  • Remove a container when it is no longer needed.

Common Lifecycle Commands

bash
docker run -d --name myapp -p 8080:80 -v ./data:/data myimage
docker start myapp
docker stop myapp
docker restart myapp
docker rm myapp
  • -d runs the container in detached mode.
  • --name assigns a stable container name.
  • -p 8080:80 maps host port 8080 to container port 80.
  • -v ./data:/data mounts a host path into the container.

Run Command Pattern

bash
docker run -d --name myapp -p 8080:80 -v ./data:/data myimage

Use this pattern when you need:

  • background execution
  • a predictable container name
  • host-to-container port mapping
  • local bind-mount persistence

Inspect Running Containers

bash
docker ps
docker ps -a
  • docker ps shows running containers only.
  • docker ps -a shows all containers including exited ones.
  • Exited containers often reveal crash-loop or entrypoint problems.

Exec Into a Container

bash
docker exec -it myapp bash
  • Use this when the container image includes bash.
  • Fall back to sh for slimmer images:
bash
docker exec -it myapp sh

Useful checks inside a container:

  • verify file paths
  • inspect environment variables
  • test network reachability
  • check permissions
  • run the application command manually

View Logs

bash
docker logs -f myapp
  • Use -f to follow logs live.
  • Add --tail 100 to reduce noise when the log is very large.
  • Container logs are the fastest first stop for boot failures.

List Images, Volumes, and Networks

bash
docker images
docker volume ls
docker network ls
  • docker images helps identify build tags and old layers.
  • docker volume ls helps track stateful storage.
  • docker network ls is useful when debugging Compose service communication.

Build Images

bash
docker build -t myapp:latest .
  • Tag images explicitly.
  • Rebuild after Dockerfile changes, dependency changes, or copy-step changes.
  • Keep the build context small with a .dockerignore.

Dockerfile Baseline

dockerfile
FROM python:3.12-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
CMD ["python", "app.py"]
  • Copy dependency manifests before source code to improve layer caching.
  • Use a narrow base image unless native toolchains are required.

Multi-Stage Dockerfile Pattern

dockerfile
FROM node:22 AS build
WORKDIR /src
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:alpine
COPY --from=build /src/dist /usr/share/nginx/html
HEALTHCHECK CMD wget -qO- http://localhost/ || exit 1
  • Build dependencies stay in the builder stage.
  • The final stage is smaller and carries less attack surface.
  • Multi-stage builds are standard for frontend artifacts, Go binaries, and compiled assets.

Health Checks

  • Define health checks in the Dockerfile when the service has a meaningful liveness probe.
  • Health checks help Compose and orchestration layers reason about readiness.

Example:

dockerfile
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD curl -fsS http://localhost:8080/health || exit 1
  • Prefer an explicit application health endpoint.
  • Avoid health checks that pass before dependencies are ready unless that is intentional.

Docker Compose Basics

bash
docker compose up -d
docker compose logs
docker compose down
  • docker compose up -d starts the stack in the background.
  • docker compose logs shows service logs across the stack.
  • docker compose down stops and removes the stack's containers and network.

Minimal Compose Example

yaml
services:
  app:
    build: .
    ports:
      - "8080:8080"
    environment:
      APP_ENV: development
    depends_on:
      - redis

  redis:
    image: redis:7-alpine
  • Compose is the default choice for local multi-service development.
  • Keep service names stable because they also become DNS names on the Compose network.

Inspect Container Metadata

bash
docker inspect myapp | jq '.[0].NetworkSettings'
  • Use docker inspect to view full JSON metadata.
  • Pipe through jq to isolate fields that matter.
  • Useful fields include mounts, networks, exposed ports, health status, and entrypoint configuration.

Resource Usage

bash
docker stats
  • This gives a live view of CPU, memory, network I/O, and block I/O.
  • Use it to spot memory leaks, unexpected idle CPU, or runaway workers.

Copy Files In and Out

bash
docker cp file.txt myapp:/app/
docker cp myapp:/app/output.log ./output.log
  • docker cp is useful for hot inspection, artifact extraction, and ad hoc debugging.
  • Prefer rebuilds for durable fixes, but docker cp can unblock investigation quickly.

Cleanup

bash
docker system prune -af
docker volume prune
  • docker system prune -af removes unused containers, networks, dangling images, and build cache aggressively.
  • docker volume prune removes unused volumes.
  • Be careful: pruning can destroy useful cached layers and orphaned but still valuable data.

Common Debugging Patterns

Override the Entrypoint

bash
docker run --rm -it --entrypoint sh myimage
  • Override the entrypoint when the default startup command exits too quickly.
  • This lets you inspect the filesystem and run the target process manually.

Check Environment Variables

bash
docker exec -it myapp env
  • Verify that expected secrets, ports, and mode flags are actually present.
  • Many container bugs reduce to missing or misspelled env vars.

Check the Effective Command

bash
docker inspect myapp | jq '.[0].Config.Entrypoint, .[0].Config.Cmd'
  • This helps distinguish build-time assumptions from runtime reality.
  • It is especially useful when wrapper scripts are involved.

Verify Mounts

bash
docker inspect myapp | jq '.[0].Mounts'
  • Bind-mount mistakes are common in local development.
  • Check source path, destination path, and access mode.

Test Networking

bash
docker exec -it myapp sh -c "wget -qO- http://redis:6379 || true"
  • Test container-to-container DNS and reachability from inside the network namespace.
  • For HTTP services, use curl or wget.
  • For TCP-only services, use the relevant client or a port probe.

Image Hygiene

  • Pin important base images when reproducibility matters.
  • Use slim runtime images where possible.
  • Minimize package-manager caches and temporary files.
  • Copy only what is needed.
  • Keep secrets out of the image entirely.

Security and Reliability Notes

  • Do not bake credentials into Dockerfiles.
  • Avoid running as root when the workload does not require it.
  • Use read-only filesystems or dropped capabilities where appropriate.
  • Scan images regularly with vulnerability tools.

Operational Guidance

  • Prefer Compose for local stacks rather than long hand-written docker run chains.
  • Use docker logs -f first when a service does not start cleanly.
  • Use docker inspect when port mappings or mounts behave unexpectedly.
  • Use health checks for services that depend on internal readiness.
  • Prune deliberately, not reflexively.

Summary

  • Manage container lifecycle with run, start, stop, restart, and rm.
  • Build images with docker build -t myapp:latest ..
  • Debug with docker exec -it myapp bash, docker logs -f myapp, docker inspect, and docker stats.
  • Operate stacks with docker compose up -d, docker compose logs, and docker compose down.
  • Clean carefully with docker system prune -af and docker volume prune.
  • Use multi-stage Dockerfiles and health checks to improve runtime quality and image hygiene.

常见问题

Docker Management AI 技能有什么作用?

Manage Docker containers, images, volumes, networks, and Compose stacks - lifecycle ops, debugging, cleanup, and Dockerfile optimization.

为什么在 TypingMind 中使用 Docker Management?

因为您只需安装一次,就能搭配任何模型使用。Docker Management 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Docker Management?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/docker-management。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Docker Management?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Docker Management 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Docker Management 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Docker Management AI 技能免费吗?

是的。AlexAI-MCP 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇