Docker 專案容器化基礎

Docker 專案容器化基礎

辨識專案的建置與啟動需求,建立第一套容器設定。

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

來源狀態

可用來源

資源類型

Skill

與類似 Skill 有什麼不同?

  • Docker Compose 模式

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

來源描述的能力

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

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

這個 Skill 是什麼?

適合尚未容器化的程式:先釐清入口、依賴與檔案邊界,再設計 Dockerfile;不是既有映像的效能調校。

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

  • 替 Spring Boot 專案建立映像。
  • 讓 React 靜態產物有獨立執行環境。
  • 整理 monorepo 各服務的 build context。

如何使用

  1. 提供專案目錄與現行 build/start 指令,不提供私人設定。
  2. 要求先畫出建置輸入、產物與 runtime 需求,再產生 Dockerfile 和 .dockerignore。
  3. 檢閱入口、權限與需掛載的資料;實際建置依專案授權另行驗證。

使用前你需要準備

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

你可以替換:

[service]、[environment]

環境與相依需求

  • Docker 20.10+;使用 Compose 時需 Compose v2,以及原專案的建置工具。

使用範例與 Prompt

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

入門

請分析這個 Spring Boot 專案的啟動方式,提出第一版 Dockerfile;暫不執行 build。

實務

替 React 專案建立 production Dockerfile 與 .dockerignore,保留目前 npm build 指令,說明哪些檔案需要進入 context。

進階

規劃 React + Spring Boot 的獨立 build context,列出編譯階段、runtime image、環境設定與持久化資料邊界;未獲同意不啟動容器。

實用提醒

  • 把設定、可持久化資料與應用程式產物分開列出。

限制與注意事項

  • 首次容器化不代表已完成部署、網路配置或效能驗證。

安全注意事項

  • 不得將 .env、registry 憑證或 SSH 私鑰放進 context 或映像層。

使用與設定

來源 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 Project Foundations

Plan the first container setup around the project’s actual build and startup requirements.

Docker · Official source · DevOps & Infrastructure

Source status

Active source

Resource type

Skill

How is this different from similar skills?

  • Docker Compose Patterns

    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?

For an application without container packaging, identify entry points and file boundaries before writing its Dockerfile. Existing image optimization is a separate task.

Use cases and when to use it

  • Package a Spring Boot service.
  • Serve a compiled React application.
  • Separate build contexts in a monorepo.

How to use it

  1. Share project structure and existing build/start commands without private settings.
  2. Map build inputs, artifacts and runtime needs before drafting Dockerfile and .dockerignore.
  3. Review entry points, permissions and persistent data; obtain authorization before builds.

What you need

  • Dockerfile or workflow
  • Service dependencies and deployment constraints

You can replace:

[service], [environment]

Environment and dependencies

  • Docker 20.10+, Compose v2 when used, and the project toolchain.

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

Inspect this Spring Boot project and propose its first Dockerfile using the existing startup command. Do not build it yet.

Practical

Create a production Dockerfile and .dockerignore for this React project, retaining npm build. Explain each required context input.

Advanced

Design separate contexts for React and Spring Boot. Document compilation stages, runtime images, configuration and persistent storage; do not start containers without approval.

Tips

  • Separate configuration, persistent data and application artifacts.

Limitations

  • Initial packaging does not establish deployment readiness or performance.

Security notes

  • Exclude private .env files, registry credentials and SSH keys from contexts and image layers.

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.