HUB
Sign inSign up
molecule-debian logo

jfxs/molecule-debian

By jfxs

•Updated 3 days ago

A Debian Docker image with systemd, to be used as a platform of Ansible Molecule (docker driver).

Image
0

999

jfxs/molecule-debian repository overview

⁠Docker molecule-debian

Inspired by geerlingguy/docker-debian12-ansible⁠ by Jeff Geerling (MIT License). This image is an update for the latest Debian releases.

Software License Pipeline Status

A Debian Docker image with systemd, to be used as a platform of Molecule⁠ (docker driver) tests of Ansible roles that manage services.

  • systemd as PID 1, with 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,
  • one tag per Debian codename, so several versions can be tested in parallel and a project can pin one,
  • multiarch with support of amd64 and arm64,
  • automatically rebuilt every week and kept up to date by Renovate⁠ (base image digests),
  • image signed with Cosign⁠, with a software bill of materials (SBOM) attestation,
  • available on Docker Hub and Quay.io.

GitLab The main repository.

Docker Hub The Docker Hub registry.

Quay.io The Quay.io registry.

⁠Tags

TagMeaning
bookworm, trixieThe last build of this Debian codename (Debian 12 and 13). Recommended: pin one in molecule.yml.
<codename>-NNNAn immutable build of a codename (trixie-001, trixie-002...), to reproduce a given run.
latestThe 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.

⁠Usage with Molecule

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.

⁠Build and test locally

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.

⁠Adding a Debian version

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).

⁠Built with

Last published tags: trixie-004, trixie⁠.

Dockerhub Overview page⁠ has the details of the last published image.

⁠Signature and attestation

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'

⁠Authors

⁠License

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.

Tag summary
Recent tags
Content type
Image
Digest
sha256:4a9de047d…
Size
71.4 MB
Last updated
3 days ago
docker pull jfxs/molecule-debian:latest