docker
Renders Dockerfiles, single- or multi-stage, from short image descriptions in the inventory, with package installation for the base image's distribution and non-root user setup.
- Latest
- 1.0.1 ·
- License
- Apache-2.0
- Owners
- Moep90
- Source
- github.com/kadet-hub/generators · 0 repo stars, shared by 35 generators
- Thumbs up
- 👍 0 on GitHub Discussions
- Popularity
- 15 · 189 pulls
Request a feature Report a problem
Badge
Show the latest listed version in your README. shields.io draws the badge from this page's badge.json, which every catalog build updates; once no version is listed, it reads "not listed".
[](https://kadet-hub.org/generators/docker/)
Docker Generator
Published on kadet-hub: pin a released version by digest from its catalog page.
Kapitan kadet generator for Dockerfiles. Each entry under dockerfiles renders one Dockerfile, single-stage or multi-stage. From a short image description it derives the package install command for the base image’s distribution (apk add --no-cache, apt-get with cache mounts for /var/cache/apt and /var/lib/apt/lists, so neither ends up in the image, dnf with dnf clean all, or pip --no-cache-dir), creates a non-root user with the matching userland (busybox adduser on Alpine, shadow useradd elsewhere) and writes the instructions in a fixed order that builds.
Built for BuildKit’s Dockerfile frontend 1.20 or later, per the Dockerfile reference at BuildKit v0.34.0: RUN --mount (also used for apt installs) and COPY --chmod need Dockerfile 1.2, RUN --network 1.3, RUN --security 1.20, and RUN --security=insecure also needs the security.insecure entitlement on the builder and the build. BuildKit is the default builder on Linux since Docker Engine 23.0.0.
Usage
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/docker@sha256:<digest>
output_path: lib/docker
compile:
- output_path: docker/
input_type: kadet
output_type: plain
input_paths:
- lib/docker
generators:
docker:
dockerfiles:
orders-api:
stages:
- stage_name: builder
base_image: python:3.14.8-slim-trixie
workdir: /build
packages: [build-essential]
copy:
- src: requirements.txt
dst: .
run:
- python -m venv /opt/venv
- command: /opt/venv/bin/pip install -r requirements.txt
mount: type=cache,target=/root/.cache/pip
- stage_name: runtime
base_image: python:3.14.8-slim-trixie
labels:
org.opencontainers.image.source: https://git.example.com/shop/orders-api
env:
PATH: /opt/venv/bin:$PATH
workdir: /app
create_user: true
user: app
uid: 10001
gid: 10001
copy:
- src: /opt/venv
dst: /opt/venv
from: builder
- src: src/
dst: /app/
chown: "10001:10001"
expose: [8000]
cmd: ["python", "-m", "orders_api", "--port", "8000"]output_type: plain is required: the generator returns the Dockerfile text.
Inputs
All keys live under parameters.generators.docker.dockerfiles.<name>. A Dockerfile has either the stage keys below or stages, a list of stages with the same keys. Every stage needs base_image.
| Key | Instruction |
|---|---|
component |
Output directory instead of <name>; may contain /. Top level only. |
base_image, platform, stage_name |
FROM [--platform=…] <image> [AS <stage>] |
labels |
one LABEL k="v" per entry |
args |
one ARG k[=v] per entry; null declares without default |
env |
one ENV k="v" per entry |
workdir |
WORKDIR |
packages, package_manager |
one install RUN; package_manager is auto (default, from the image name: alpine is apk, fedora/centos/rhel/rocky/alma is dnf, everything else apt), apk, apt, dnf or pip |
create_user, user, uid, gid |
with create_user: true, a RUN that creates group and user (uid/gid default 1000); user alone only emits USER |
copy |
COPY; an item is a string ("src dst") or a dict with src, dst, from, chown, chmod |
run |
RUN; an item is a string, a list (joined with &&) or a dict with command, mount, network (default, none, host), security (sandbox, insecure) |
volumes, expose |
one VOLUME / EXPOSE per item |
healthcheck |
NONE, or a dict with cmd (string or list), interval, timeout, start_period, retries |
entrypoint, cmd |
list for exec form, string for shell form |
Instructions are written in the order of the table, with packages before user creation and USER, so packages always install as root; the RUN steps after it run as user, and copied files stay owned by root unless chown is set. Without user the image’s default user applies, which is root for most official images; set user for anything that does not need root at runtime. Values that would break a single-line instruction (newlines) are rejected, as are unknown package_manager, network and security values and out-of-range uid, gid and ports.
Build secrets do not belong in args or env, where they end up in the image history; use run with mount: type=secret,id=<id>.
Output
| File | Content |
|---|---|
<output_path>/<name>/Dockerfile |
one Dockerfile per entry, or <output_path>/<component>/Dockerfile |
Versions
Add a version's inventory entry, then compile with the consumer workflow, which verifies the artifact and runs Kapitan in the sandbox.
Free of charge, as is and on a best-effort basis: use at your own risk, and review the compiled output before you apply it. Terms
This catalog was built from index serial 47. Set index_serial: 47 in .kapitan-sandbox.yaml and the consumer workflow refuses any older index, so a rolled-back index cannot bring back a yanked version.
Checks find known patterns; they do not prove a generator safe. What a listing covers
| Version | Built for (schema-checked) |
|---|---|
| 1.0.1 | not recorded |
1.0.1#
Inventory
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/docker:1.0.1@sha256:14804771b377d4f60d05a081bfbc33c8daf297cb12eb3d6d6c4b5c3c400733d2
output_path: lib/docker
Verify
gh attestation verify \
oci://ghcr.io/kadet-hub/docker@sha256:14804771b377d4f60d05a081bfbc33c8daf297cb12eb3d6d6c4b5c3c400733d2 \
--owner kadet-hub \
--cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main
Transparency log: Rekor entry 3228624863, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.
- Kapitan declared
- >=0.36.3,<0.37
- Kapitan checked
- 0.36.3
- Backends checked
- not recorded
- With --cache
- not recorded
- krab
- compatible
- Built for (schema-checked)
- not recorded
- Source
- docker-v1.0.1 ·
ca05de90ff25a93dc78341b2ab9f1fb7ff09271f· docker - Binaries
- none
- Output capabilities
- none
- Digest
sha256:14804771b377d4f60d05a081bfbc33c8daf297cb12eb3d6d6c4b5c3c400733d2
Checks
Checked by the release run on , gate at 8332c5f54566.
- Secrets gitleaks 8.30.1
No secret matched the marketplace's gitleaks rules. - Malware ClamAV 1.5.4
No file matched a ClamAV signature. - Malicious package heuristics GuardDog 3.2.0
No GuardDog threat rule matched. - Dangerous code Semgrep 1.180.0
No marketplace Semgrep rule matched, such as eval, subprocess or network calls. - Python errors Ruff 0.17.0
No syntax error or undefined name (Ruff, error rules only). - File tree tree_check.py
No symlink, executable or banned file; imports within the allowlist. - Sandboxed compile gVisor 20261005, Kapitan 0.36.3
The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read. - Output capabilities Conftest 0.71.1
The compiled output uses only the capabilities the manifest declares. - CI detection Kapitan 0.36.3
The output is the same with CI variables set.
Output diff
No output diff recorded: this version was published before the release run recorded one.