chef icon indicating copy to clipboard operation
chef copied to clipboard

Enable use of podman to run tests

Open tomhughes opened this issue 2 months ago • 4 comments

This adds support for using podman to run tests - you just need to run systemctl --user enable --now podman.socket to enable the podman socket for your user and that you can run tests as normal.

Note that until https://github.com/test-kitchen/kitchen-dokken/pull/323 is merged you need to set DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock in the environment to make it work.

tomhughes avatar Apr 02 '24 21:04 tomhughes

I tested this on a Mac using podman machine... I was only able to get this to work after stripping out all the docker_host_url lines and just setting podman = true

Podman on Mac uses an unconventional socket. DOCKER_HOST=unix:///var/folders/kv/sb3s4k3n0zq27rtr2yd_2lc00000gn/T/podman/podman-machine-default-api.sock Podman can also set a /var/run/docker.sock symlink, but this isn't done by default due to requiring extra permissions.

Firefishy avatar Apr 04 '24 12:04 Firefishy

That sounds like you were trying to use rootful podman not rootless.

On linux you can enable the system podman.socket which uses /run/podman/podman.sock and which /run/docker.sock points at (if you have podman-docker installed) or you can enable a per-user socket by starting the user podman.socket unit for a user.

The system one is only available to root so isn't very useful here while the per-user one is only available to the user that started it - there is no equivalent to the docker group on Ubuntu/Debian that allows everybody in it to access the global instance.

tomhughes avatar Apr 04 '24 12:04 tomhughes

Likely complicated by the use of podman machine... But I appears to be rootless

podman info reports:

host:
  security:
    rootless: true

Firefishy avatar Apr 04 '24 17:04 Firefishy

What do you mean by using podman machine though? You shouldn't be interacting with podman directly at all, just with kitchen by doing something like bundle exec kitchen test apache-ubuntu-2204.

tomhughes avatar Apr 04 '24 17:04 tomhughes