Skip to content
Back to skills

Containerize

ASecurity

Containerise the current project - Dockerfile, .dockerignore and compose.yaml with current Docker practice.

  • 95 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 9, 2026
developmentpythonrustgojavaphpshellbashnodedockerkubernetes

Works with

  • terminal
  • cli

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned November 13, 2026

npx -y skills add henkisdabro/wookstar-claude-plugins --skill containerize --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Containerize?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Containerize
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/henkisdabro-containerize/badge)](https://www.skillsdirectory.com/skills/henkisdabro-containerize)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: containerize
description: Containerise the current project - Dockerfile, .dockerignore and compose.yaml with current Docker practice.
disable-model-invocation: true
argument-hint: "[runtime or service to containerise]"
allowed-tools:
  - Read
  - Write
  - Edit
  - Grep
  - Glob
  - WebFetch
  - Bash(docker *)
  - Bash(podman *)
---

# Containerise

Target: $ARGUMENTS (empty means the whole repository).

## 1. Survey

Find the runtime and package manager from the lockfile: `pnpm-lock.yaml`, `package-lock.json`, `bun.lock`, `uv.lock`, `poetry.lock`, `requirements.txt`, `go.mod`, `Cargo.toml`, `pom.xml` / `build.gradle`. Note the start command, listening port, health endpoint, and the backing services the code connects to (database, cache, queue). Read any existing `Dockerfile`, `.dockerignore` or Compose file - you extend them rather than replace them.

Done when you can name the runtime, package manager, build command, start command, port and every backing service.

## 2. Scaffold

Only when step 1 found no Dockerfile. Steps 3-5 write the files by hand. `docker init` prompts interactively and the Bash tool has no terminal, so offer it to the user as an alternative they run themselves - it scaffolds `Dockerfile`, `.dockerignore`, `compose.yaml` and `README.Docker.md` for Node, Python, Go, Rust, Java, ASP.NET Core and PHP.

Done when the user has run `docker init` and its files are open for steps 3-5 to revise, or has declined it.

## 3. Write the Dockerfile

Read [references/patterns.md](references/patterns.md) for the runtime's pattern, then apply every rule:

- **Multi-stage**: a build stage with the toolchain; a runtime stage carrying only the built artefact and production dependencies.
- **Pinned base images**: look up the current tag on the image's registry page and pin it by digest (`image:tag@sha256:...`). Get the digest with `docker buildx imagetools inspect image:tag`.
- **Minimal runtime**: distroless (`gcr.io/distroless/*-debian13`), Docker Hardened Images, or a `-slim` variant when the app needs a shell or system libraries.
- **BuildKit cache mounts** on every package-manager install (`RUN --mount=type=cache,target=...`), with the lockfile copied or bind-mounted before the source so dependency layers survive source edits.
- **Frozen installs**: `pnpm install --frozen-lockfile`, `npm ci`, `bun install --frozen-lockfile`, `uv sync --locked`.
- **Non-root numeric user**: `USER 65532:65532` on distroless, or create a user with a fixed UID/GID. Numeric IDs let Kubernetes `runAsNonRoot` verify it.
- **Exec-form `CMD`/`ENTRYPOINT`** so the process is PID 1 and receives SIGTERM.
- **`HEALTHCHECK`** against the health endpoint, using a binary the runtime image actually contains - distroless has no `curl`; see the healthcheck section of the patterns file.
- **Build-time credentials** through `RUN --mount=type=secret`, leaving `ENV`, `ARG` and every layer free of secrets.

Done when every rule above is either applied or has a one-line comment in the Dockerfile saying why not.

## 4. Write .dockerignore

Exclude VCS data, dependency folders (`node_modules`, `.venv`), build output, local env files (`.env*` but keep `.env.example` if the build needs it), test reports, editor folders and the Dockerfile and Compose files themselves.

Done when `docker build` reports a small context transfer and no secret file is inside it.

## 5. Write compose.yaml

Name it `compose.yaml` (the Compose preferred name) and leave out the top-level `version:` key - it is obsolete and Compose warns when it is present. Add the backing services from step 1, each with a `healthcheck`, and make the app wait with `depends_on: { db: { condition: service_healthy } }`. Put credentials in an `env_file` or `secrets`, never inline. Use named volumes for data.

Done when `docker compose config` prints the merged file without errors or warnings.

## 6. Verify

```bash
docker build -t app:local .
docker compose up -d --wait
docker compose ps
docker run --rm --entrypoint id app:local   # skip on distroless; check with docker inspect -f '{{.Config.User}}'
```

Done when the build succeeds, `--wait` returns with every service healthy, the app answers on its port, and the runtime user is not 0. Report the final image size (`docker image ls app:local`) and anything left as a deliberate exception from step 3.

Files in this skill

  • SKILL.md4.2 KB
  • references/patterns.md4.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.