A very quick entry for today. Sometimes the test-containers project (in its java version) is used to add some tests that involve docker in my daily job. The idea is using containers for complicated tests which cannot be easily mocked up and therefore need the full software image. But I have a fedora laptop now and it incorporated podman instead of docker. They are two different container engines, and, although the former was implemented having docker in mind, they are similar but not exactly the same. Therefore the test-containers project needs some tweaks to make it work in my box. Here I am going to summarize the steps that are more or less explained in this issue report.
Start the podman service. One of the main difference of podman is that it is daemonless, so we need to start the service in order to have something the test-containers project can talk to.
podman system service -t 0 &
After that just export some environmental variables to the java project. The unix socket depends on our user (it is not root based) and some features should be disabled from the test-containers because they do not work under podman.
export DOCKER_HOST=unix:///run/user/${UID}/podman/podman.sock
export TESTCONTAINERS_CHECKS_DISABLE=true
export TESTCONTAINERS_RYUK_DISABLED=true
Usually the previous two steps are enough but remember you can specify several things under ~/.config/containers directory. For example the registries you want search images from by default.
cat ~/.config/containers/registries.conf
unqualified-search-registries=["docker.io", "quay.io"]
That is all. A very short post that I wanted to have in the blog. I am going to need this from time to time. And my memory is very bad for these random things. This way I can always look to this entry and just copy the commands without thinking what they do or why I need them. Sadly the entry will be obsolete soon, but until that moment it will save me a lot of time.
Best regards!
Comments