A Debian Docker image with systemd, to be used as a platform of Ansible Molecule (docker driver).
999
molecule-debianInspired by geerlingguy/docker-debian12-ansible by Jeff Geerling (MIT License). This image is an update for the latest Debian releases.
A Debian Docker image with systemd, to be used as a platform of Molecule (docker driver) tests of Ansible roles that manage services.
systemd-sysv, sudo, procps, iproute2 and dbus,ca-certificates: the TLS trust store of any real host, so HTTPS downloads (get_url, uri) work out of the box,cron, enabled at boot, for roles that manage crontabs (cron module, /etc/cron.d),python3 and python3-apt: what Ansible needs on a target (the apt module). No Ansible in the image: Molecule runs on the controller and drives the container,multiarch with support of amd64 and arm64,SBOM) attestation,| Tag | Meaning |
|---|---|
bookworm, trixie | The last build of this Debian codename (Debian 12 and 13). Recommended: pin one in molecule.yml. |
<codename>-NNN | An immutable build of a codename (trixie-001, trixie-002...), to reproduce a given run. |
latest | The current stable Debian (the codename of debian:latest). It moves automatically to the new codename when Debian releases a new stable version, once that codename is built. |
Prefer the codename tag over latest in your molecule.yml: latest changes the Debian version under your tests when Debian publishes a new stable release.
platforms:
- name: instance
image: jfxs/molecule-debian:trixie
pre_build_image: true
command: /usr/lib/systemd/systemd
cgroupns_mode: host
privileged: true
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
Without Molecule:
docker run --detach --privileged --cgroupns=host --tmpfs /run --tmpfs /tmp \
--volume /sys/fs/cgroup:/sys/fs/cgroup:rw jfxs/molecule-debian:trixie
This image is for isolated tests, not for production.
task install-templates # fetch the task templates (first time)
task 00:10-build-local C=bookworm # build molecule-debian:bookworm (default codename: trixie)
task 00:20-test-local IMG=molecule-debian:bookworm
Without task: docker build --build-arg VERSION=bookworm -t molecule-debian:bookworm . then tests/acceptance.sh molecule-debian:bookworm.
tests/acceptance.sh starts the container and checks that systemd is running, that python3 imports apt, that ca-certificates is installed and an HTTPS download works, that cron is installed and active at boot, and that a service (cron) can be stopped and started.
Add a base stage (FROM debian:<codename>@sha256:... AS base-<codename>) to the Dockerfile, an inclusion of the docker component and a matrix entry in .gitlab-ci.yml. tests/check_ci.sh verifies that the codenames agree everywhere (task 00:30-test-scripts, also run by the scripts:test CI job).
Last published tags: trixie-004, trixie.
Dockerhub Overview page has the details of the last published image.
The image is signed with Cosign and carries a SBOM attestation:
cosign verify --key cosign.pub $IMAGE_URI
cosign verify-attestation --key cosign.pub --type spdxjson $IMAGE_URI | jq '.payload | @base64d | fromjson | .predicate'
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License (MIT). See the LICENSE for details.
docker pull jfxs/molecule-debian:latest