Logo Docker

Docker

Cộng đồng
nahid-sparktales
docker

Build container images that are reproducible, small, and safe to run — layer order and what actually caches, multi-stage builds, and what belongs in an image versus what must never be baked into one. Use when writing or reviewing a Dockerfile, when an image build is slow, bloated, or non-deterministic, or when deciding how configuration and secrets reach a container. Not for orchestration, cluster or compose topology, not for CI workflow authoring (github-actions), and not for pipeline stage design (ci-cd).

Tổng quan

Nhà phát hànhnahid-sparktales
Kho mãagent-dispatcher
Tên kỹ năngdocker
Sao
58
Bản fork
5
Tệp đi kèm
1
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ộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được nahid-sparktales 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 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/nahid-sparktales/agent-dispatcher/tree/main/skills/devops/docker
  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/nahid-sparktales/agent-dispatcher.git /tmp/agent-dispatcher
mkdir -p .claude/skills
cp -r /tmp/agent-dispatcher/skills/devops/docker .claude/skills/docker
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 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 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 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 images

An image is a build artifact with a filesystem attached. Most of what goes wrong with one is decided by the order of a dozen lines: what got cached, what got copied in that should not have been, and what the container is running as when it starts.

A built image is not a running service. "The build succeeded" says the layers assembled, nothing about whether the thing inside starts, serves, or shuts down.

When this fires

A Dockerfile is being written, changed, or reviewed; a build is slow or gives different results on different machines; an image is unexpectedly large; or config and credentials need a route into the container. It does not fire for scheduling, networking between services, or a bug in the application code that happens to be containerized.

Procedure

  1. Read what exists first — the Dockerfile, .dockerignore, and how the image is actually built (locally, in CI, with what build args). Most "write me a Dockerfile" tasks are really a fix to the one already there, and a second parallel Dockerfile is how two images drift.
  2. Choose the base deliberately and pin it. Prefer the language's official image or a slim variant; pin to a digest when reproducibility matters, because a tag moves under you. Alpine and other musl-based images are smaller but are a different libc: native extensions, DNS behaviour, and timezone handling can all differ from what you tested on. Take the smaller base only when you have run the app on it.
  3. Write .dockerignore before you build. Without one, the build context carries .git, node_modules, local env files, and build output to the daemon on every build — slow, and the direct cause of a credential ending up inside an image after a broad copy.
  4. Order instructions by rate of change, slowest first: system packages, then dependency manifests plus the install, then application source last. Copy the manifest and lockfile alone before the source, so a source edit does not invalidate the dependency layer. Any instruction invalidates every layer after it — this ordering is the whole of build caching.
  5. Use a multi-stage build so compilers, dev dependencies, and test tooling never reach the runtime image. Build in one stage, copy only the produced artifact into a clean runtime stage. This is usually the single largest size reduction available, and it shrinks the attack surface at the same time.
  6. Keep secrets out of the image entirely. A build argument or environment variable set at build time is recorded in image metadata. Copying a secret in and deleting it later does not remove it — the earlier layer still holds it. Use BuildKit's build-time secret mounts, or fetch the credential at runtime. If a secret was ever baked into an image that has been pushed anywhere, that is a leaked credential: stop, say so plainly, and treat rotation as the fix.
  7. Install packages in one layer and clean up in the same instruction. Splitting the index update from the install lets a stale cached index install stale packages; leaving package manager caches behind inflates the layer permanently, because deleting them later only adds another layer. Use a build cache mount for package caches you want to reuse across builds.
  8. Run as a non-root user. Create the user, give it ownership of only the paths it must write, and set USER before the entrypoint. Containers run as root by default and almost nothing needs it. If the process must bind a low port, change the port rather than keeping root.
  9. Get PID 1 right. Use the exec form of the entrypoint and command so your process is PID 1 and receives signals directly. In shell form the shell is PID 1, SIGTERM is not forwarded, and the container is killed hard after the grace period — no graceful shutdown, no connection draining, and it looks fine locally. Add a minimal init process when the app spawns children it does not reap.
  10. Take configuration at run time, not build time. An image that bakes in an environment's URLs or feature flags is one image per environment, which breaks build-once-promote: what you tested is not what you ship. Bake only what is genuinely invariant.
  11. Build it, then look at it. Build clean, then build again unchanged and confirm the cache behaves as the ordering predicts. Inspect the layer sizes and the final size against the previous one. Then run it: confirm it starts, serves a real request, exits within a second or two on SIGTERM, and does so as the non-root user.
  12. Scan before it goes anywhere, and stop there. Pushing to a registry, moving a shared tag such as latest, and pruning images or volumes on a machine you do not own are all outward or destructive: prepare them, say exactly what would be pushed or removed, and ask.

Checklist

  • .dockerignore exists and excludes VCS, local dependencies, env files, and build output
  • Base image pinned; its libc is one the application has actually run on
  • Dependency install sits above the source copy, and a source edit reuses it
  • Build tooling exists only in a build stage, not in the runtime image
  • No secret in a build arg, an env var, or any layer — checked, not assumed
  • Explicit non-root USER, with ownership of the paths it writes
  • Exec-form entrypoint; container observed exiting promptly on SIGTERM
  • Environment-specific config supplied at run time
  • Image built, run, and exercised — not just built

Failure handling

  • The cache never hits. Something high in the file changes every build: a broad COPY above the dependency install, a timestamp or commit SHA in an early build arg, or a missing .dockerignore letting the context differ each time. Find the first layer that rebuilds; the cause is at or above it.
  • It works locally and fails in CI. Suspect, in order: an unpinned base tag that moved, a file present locally but ignored or absent in the CI context, a different architecture, and build args supplied in one place only. Compare the two build contexts before changing the Dockerfile.
  • The image is still huge after a multi-stage build. Layer size, not final content, is what counts: a file added and removed in a later instruction is still carried. Look at per-layer sizes and find the fat one rather than guessing.
  • The container exits immediately. Read its logs before editing anything. A foreground process that backgrounds itself, a missing runtime dependency dropped between stages, and a permission error after adding USER all present the same way.
  • No way to build or run here. Say the image was written but never built, and never describe it as working. A Dockerfile that has not been built is a draft.

Evidence to report

The final image size and how it compares to before. The result of the second, unchanged build — which layers were cached. What the container did when run: startup, one real request served, and the observed shutdown on SIGTERM. The user id the process runs as. Scanner findings, with severities, or a statement that no scan was run. And what was not checked — other architectures, other environments, and registry push, if the push has not happened.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

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

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

Build container images that are reproducible, small, and safe to run — layer order and what actually caches, multi-stage builds, and what belongs in an image versus what must never be baked into one. Use when writing or reviewing a Dockerfile, when an image build is slow, bloated, or non-deterministic, or when deciding how configuration and secrets reach a container. Not for orchestration, cluster or compose topology, not for CI workflow authoring (github-actions), and not for pipeline stage design (ci-cd).

Vì sao nên dùng Docker 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 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 trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/devops/docker. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà 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?

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 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 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 có miễn phí không?

Có. Kỹ năng này được nahid-sparktales 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 👇