Docker Compose 模式

Docker Compose 模式

安排多個服務的網路、資料卷、健康檢查與設定。

Docker · 官方來源 · DevOps 與基礎架構

來源狀態

可用來源

資源類型

Skill

與類似 Skill 有什麼不同?

  • Docker 專案容器化基礎

    Docker Project Foundations 建立專案容器基礎;Docker Compose Patterns 處理多服務連線、啟動與組態協作。

來源描述的能力

這些是來源描述的可能操作,不代表 2lus 已授予權限或已測試。

  • 讀取檔案
  • 寫入檔案
  • Shell 指令
  • Docker 操作
原始來源 ↗

這個 Skill 是什麼?

把 frontend、API 與資料庫的連接需求明確化,建立可維護的 Compose 定義,而非只列出多個 image。

可以做什麼?何時適合使用?

  • 整合 Spring Boot 與 MySQL。
  • 拆分 React、API 和 Redis 的 network。
  • 整理 NAS 的 persistent volume 與服務設定。

如何使用

  1. 列出服務、連接埠、資料保存期限及設定來源。
  2. 定義內外網路與 named volumes,補上健康檢查和依賴條件。
  3. 檢閱開發/正式環境差異與資料還原步驟;啟動需另行批准。

使用前你需要準備

  • Dockerfile 或 workflow
  • 服務依賴與部署限制

你可以替換:

[service]、[environment]

環境與相依需求

  • Compose v2、Docker,以及有權存取的服務映像與設定範本。

使用範例與 Prompt

以下是 2lus 撰寫的示範需求;請替換為你有權處理的檔案與專案,不代表已執行或保證結果。

入門

替 Spring Boot + MySQL 草擬 Compose,標出 internal network 與資料卷;不要啟動服務。

實務

設計 Frontend + API + MySQL 的 Compose,包含 healthcheck、persistent volume 和健康狀態依賴,秘密只引用外部設定。

進階

檢閱這份 NAS Compose 的開發與正式 override,說明 volume ownership、資料備份、啟動重試與回復方案,不改動現有資料。

實用提醒

  • depends_on 的順序不等於應用程式永遠可用,API 仍需重試策略。

限制與注意事項

  • 健康檢查失敗原因與 NAS 檔案權限需要在部署環境驗收。

安全注意事項

  • 勿將資料庫 port 無故公開;不得以 down -v 當作一般重新啟動。

使用與設定

來源 README 的互動式安裝方式;選擇需要的 Skill 與宿主。此處只能複製,不會執行。

npx skills add docker/skills
官方文件 ↗

支援平台

Claude Code — 文件記載,未做實機相容性測試 官方文件 ↗

Codex — 文件記載,未做實機相容性測試 官方文件 ↗

Cursor — 文件記載,未做實機相容性測試 官方文件 ↗

GitHub Copilot — 文件記載,未做實機相容性測試 官方文件 ↗

來源與授權

來源查核日期(非安全認證): 2026-09-29

Apache-2.0

原始來源 ↗ 授權條款 ↗ 官方文件 ↗

相關 Skills

使用第三方 Skill 前,請先檢查來源、權限與執行內容。安裝指令只供查看與複製,不會由 2lus 執行。

2lus AI Skills Library 提供 Skill 的整理與使用導覽。第三方 Skill 的內容、授權與可用性以原始來源為準。使用或安裝前,請自行確認其權限與執行內容。

Docker Compose Patterns

Define networks, persistent volumes, health checks and configuration across services.

Docker · Official source · DevOps & Infrastructure

Source status

Active source

Resource type

Skill

How is this different from similar skills?

  • Docker Project Foundations

    Docker Project Foundations establishes container project basics; Docker Compose Patterns coordinates multiple services and configuration.

Documented capabilities

These are operations described upstream, not permissions granted or tested by 2lus.

  • Read files
  • Write files
  • Shell commands
  • Docker operations
Original source ↗

What is this skill?

Make frontend, API and database connections explicit in a maintainable Compose definition instead of merely listing images.

Use cases and when to use it

  • Connect Spring Boot to MySQL.
  • Separate React, API and Redis networks.
  • Organize persistent storage on a NAS.

How to use it

  1. List services, ports, data retention and configuration sources.
  2. Define internal/external networks, named volumes and health-based dependencies.
  3. Review environment overrides and restoration procedures; seek approval before startup.

What you need

  • Dockerfile or workflow
  • Service dependencies and deployment constraints

You can replace:

[service], [environment]

Environment and dependencies

  • Compose v2, Docker and authorized service images/configuration templates.

Usage and prompt examples

These example requests were written by 2lus. Substitute files and projects you may use; examples are not executed results or guarantees.

Beginner

Draft Compose for Spring Boot and MySQL. Identify the internal network and persistent volume; do not start services.

Practical

Design Frontend + API + MySQL Compose with health checks, persistent storage and readiness dependencies; reference secrets externally.

Advanced

Review NAS development/production overrides for volume ownership, backup, startup retries and rollback without changing existing data.

Tips

  • Startup ordering is not continuous readiness; applications still need retries.

Limitations

  • NAS permissions and health-check failures require deployment-specific acceptance.

Security notes

  • Avoid unnecessary public database ports; down -v is not a routine restart.

Usage and setup

Interactive installation documented in the README; select skills and host. This page only copies the command.

npx skills add docker/skills
Documentation ↗

Supported agents

Claude Code — Documented; not runtime-tested Documentation ↗

Codex — Documented; not runtime-tested Documentation ↗

Cursor — Documented; not runtime-tested Documentation ↗

GitHub Copilot — Documented; not runtime-tested Documentation ↗

Sources and license

Source check date (not a safety certification): 2026-09-29

Apache-2.0

Original source ↗ License terms ↗ Documentation ↗

Related skills

Before using a third-party skill, review its source, permissions and executable content. Commands are for viewing and copying only; 2lus does not execute them.

2lus AI Skills Library provides curated educational guides. Third-party content, licenses and availability are governed by their original sources. Review permissions and executable content before use or installation.