Logo Docker Management

Docker Management

Cộng đồng
AlexAI-MCP
docker-management

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

Add to TypingMind

Tổng quan

Nhà phát hànhAlexAI-MCP
Kho mãhermes-CCC
Tên kỹ năngdocker-management
Sao
134
Bản fork
22
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được AlexAI-MCP công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Docker Management trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/docker-management
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Docker Management trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Docker Management ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Docker Management với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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.

Câu hỏi thường gặp

Kỹ năng AI Docker Management làm được gì?

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

Vì sao nên dùng Docker Management trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Docker Management là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Docker Management trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/docker-management. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Docker Management?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Docker Management với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Docker Management với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Docker Management có miễn phí không?

Có. Kỹ năng này được AlexAI-MCP phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇