Podman 3 and Docker Compose - How Does the Dockerless Compose Work?
Since Podman version 3 there is a docker compose support!
For a long time, Podman didn't have exactly the same convenient and quick way to create a multi-container local environment. You had two options:
Use a separate Python-based podman-compose tool, that promises to work seemlessly and without any modifcations
Or use a rather awkward podman generate kube
command, which gives you a Kubernetes pod definition. You can then run this yaml with podman play
command - awesome idea, in theory.
Now with the new major release, there is no need for extra tools, we can just use Podman and regular docker-compose to run the docker compose files. You heard me right - we still need to install docker-compose itself.
Let's give it a try - I am using docker compose for developing Transcripto, check out our Making a Product show to learn more about how we built this service.
According to documentation, I first need to enable a podman socket, which requires root privileges.
Then I need to verify that docker socket is listening - that's kind of weird. Naturally, it does not work, because I've stopped the docker daemon beforehand.
After digging into the documentation a bit deeper, I learned that I need to install a podman-docker package. This package is basically a bunch of symlinks and various hacks ro make it look like you are using docker, while you are actually using podman.
When I tried to install it, I quickly learned that I have to remove, quite naturally, remove the docker package from my system. Well, if I can use docker-compose with podman, I probably don't need docker itself anyway.
With all the packages in place, I've restarted the podman socket and now the docker socket is also listening. If you check where the docker socket is going, you will see that it basically maps to podman socket, as expected.
I've tried to run docker-compose and got a permission denied error. Apparently, I need to run this as a root. So much for rootless containers here.
The second error I got, somehow misleading, was a lack of disk space. I have a lot of disc space, so there must be something. Quickly realizing that the ownership and labeling of files must be wrong due to previously installed docker, I removed some temporal files.
On the text attempt, docker-compose finally succeeded.
It looks and works exactly like you would expect from docker-compose, but the underlying container engine is Podman now.
Ignoring few minor issues, I could quickly replace Docker with Podman for this project, and my development experience stayed the same. Give it a try, it has never been a better time to taste the Dockerless world.
Here's the same article in video form for your convenience: