Using Dokken with podman is a little less straight forward than with Docker. The main problem is volumes are not populated when they are first created.
As per this issue, we can use lifecycle hooks to create the volume and populate it with the Chef executable before we try and start the main container.
Note, if you’re using a specific version of Chef, and not latest, then you need to reference the correct version in your podman create command because this breaks the automatic pulling of the correct version of the Chef Docker image by kitchen-dokken.
---
driver:
name: dokken
privileged: true # allows systemd services to start
provisioner:
name: dokken
transport:
name: dokken
login_command: podman
verifier:
name: inspec
platforms:
# @see https://github.com/chef-cookbooks/testing_examples/blob/main/kitchen.dokken.yml
# @see https://hub.docker.com/u/dokken
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
suites:
- name: default
run_list:
- recipe[test_linux::default]
verifier:
inspec_tests:
- test/integration/default
lifecycle:
pre_create:
- podman create --name chef-latest --replace docker.io/chef/chef:latest sh
- podman start chef-latest
post_destroy:
- podman volume prune -f
Note: Specifying podman
as the login_command
in the transport
section can solve the issue if you are unable to log into the instance using kitchen login
when Docker isn't installed on your machine.