- name
SKILL.md
File skill tetap berada di repositori penerbit.
Tempel perintah yang disalin di terminal. Perintah itu memasang SKILL.md ini ke agen tersebut.
npx skills add docker/skills --skill docker-project-foundations -a cursor -yTempel perintah yang disalin di terminal. Perintah itu memasang SKILL.md ini ke agen tersebut.
npx skills add docker/skills --skill docker-project-foundations -a claude-code -yTempel perintah yang disalin di terminal. Perintah itu memasang SKILL.md ini ke agen tersebut.
npx skills add docker/skills --skill docker-project-foundations -a codex -yTempel perintah yang disalin di terminal. Perintah itu memasang SKILL.md ini ke agen tersebut.
npx skills add docker/skills --skill docker-project-foundations -a grok -yKirim pesan yang disalin di chat Grok Bot. Bot mengambil SKILL.md ini dari GitHub dan menambahkannya ke skill yang dipakai bersama oleh semua Bot Anda.
Install this skill: https://github.com/docker/skills/tree/HEAD/skills/docker-project-foundationsDari penerbit
This skill guides you in Dockerizing a project from scratch. It focuses on creating the initial Docker file set, choosing a sane layout, and preferring containerized dependencies over host-level installs.
Activate this skill when:
Dockerfile, compose.yaml, or .dockerignore and does not have oneDo not use this skill when:
DockerfileWhen Dockerizing a project, always produce all three:
.dockerignore — Create this first so the initial build context is small and safe. See assets/dockerignore-example for a reference.Dockerfile — Create a working starter image definition that the project can build and run with. Start from assets/Dockerfile.simple and keep its baseline, even for a first scaffold:
node:22-slim), never latest;package.json + lockfile) copied before the source for layer caching;USER set in the final stage before CMD/ENTRYPOINT.compose.yaml — Create a local development stack that includes the application service and any required dependencies. See assets/compose-dev.yaml..npmrc at every depth with **/.npmrc in .dockerignore; otherwise a broad source copy can persist credentials in image layers.npmrc as a BuildKit secret for both npm ci steps. Public-package builds need no secret. For private registries, pass the config explicitly:
DOCKER_BUILDKIT=1 docker build --secret id=npmrc,src="$HOME/.npmrc" .
Use the actual config path if the project keeps it elsewhere. Never copy the credential file or pass its values through ARG or ENV. Dependency scripts run during installation can access the mounted secret; use trusted dependencies and a least-privilege registry token.compose.npm.yaml alongside the starter's compose.yaml:
services:
app:
build:
secrets:
- npmrc
secrets:
npmrc:
file: ${NPMRC_PATH:?Set NPMRC_PATH to your npm config file}
Build with NPMRC_PATH="$HOME/.npmrc" docker compose -f compose.yaml -f compose.npm.yaml build. This grants build-time access only, not a runtime secret. Public-package builds should omit the override so no credential file is required.When a project needs a database (Postgres, MySQL, MongoDB), cache (Redis, Memcached), queue (RabbitMQ, Kafka), or any other infrastructure service:
compose.yaml instead of telling the user to install it on the host.brew install postgres, apt install redis, or similar host-level installs for development dependencies.compose.yaml rather than legacy Compose filenames.docker/ subdirectory..env override.USER).Dockerfile that supports both via build stages and build arguments when possible.Dockerfile at the project root (or in a docker/ subdirectory if the project has multiple services).compose.yaml at the project root..dockerignore at the project root, next to the Dockerfile.docker-build-strategies. The starter baseline above (including a non-root USER) still applies here.docker-compose-patterns.docker system prune, docker rm -f, image/network/builder pruning) and a cross-product index of destructive-command guardrails, use docker-destructive-guardrails.references/project-structure.md — Detailed guidance on Docker project file organization, naming conventions, and multi-service layouts.assets/dockerignore-example — A comprehensive .dockerignore for a typical project.assets/compose-dev.yaml — A development-oriented Compose file with Dockerized dependencies.assets/Dockerfile.simple — A basic multi-stage Dockerfile following best practices.scripts/verify-setup.sh — Checks that required files exist in the current directory and validates its compose.yaml. Run it from the project root, with the script path resolved under this skill's directory:
bash "<skill-dir>/scripts/verify-setup.sh" [--help]
Replace <skill-dir> with the absolute path of the folder that contains this SKILL.md; the scripts/ path is relative to that folder, not to the project. Do not change into the skill directory first: the script checks the current directory. If the skill directory cannot be resolved, check that .dockerignore, Dockerfile, and compose.yaml exist in the project root, then run docker compose config --quiet. Exit status is 0 when verification succeeds or help is requested, 1 when required files are missing or the Compose configuration is invalid, and 2 for invalid arguments.checks/verification.md — Detailed verification checklist for manual review.Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database o
---name: docker-project-foundationsdescription: Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly…---# skills/docker-project-foundations/SKILL.mdRingkasan umum
Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.
FAQ
Unduh skills/docker-project-foundations/SKILL.md dari penerbit, atau salin path-nya dan buka repositori. PlugMCP hanya mendaftar skill ini dan tidak meng-host filenya.
Penerbit menyimpannya di https://github.com/docker/skills.
Claude, Cursor, Codex, dan Grok Build bisa membaca SKILL.md yang Anda tambahkan dari repositori penerbit. Grok Bot memasangnya saat Anda mengirim tautan folder GitHub skill tersebut di chat.