My Switch From Docker to Podman
About my hate-love-relationship with docker and how I switched from docker to podman.
First of all, I have to say that I didn't try to simply alias the docker command to podman, but I guess for most people, this should be the way to go.
To stop and remove the dockers that are running, you can shut down the docker.service
with systemctl stop docker
and then disable it so that it won't start after a reboot with systemctl disable docker
. Then, create an alias
in the .bashrc
file by opening it with vim ~/.bashrc
, going to the last line, and adding alias docker=podman
. Don't forget to source it with source ~/.bashrc
.
If you're running podman on Debian 11 like me, you may receive an older version (~3.x), which isn't the newest. In this case, you can compile podman yourself. I found a different blog entry that helped me a lot with this, and I'll link it at the end of my blog entry.
I had some troubles with the 3.x version, such as being unable to use shortnames like vaultwarden:latest
. However, this can be fixed easily by adding docker.io/
in front of the shortname, for example:
docker.io/vaultwarden:latest
.
My main reason for compiling podman myself was because I was unable to run the gitea docker-compose. Unfortunately, I didn't note my issue here, but it was something like unrecognized command "podman xy exists"
.
I found this podman-compose issue on GitHub
The next thing I had trouble with was still having a Docker container that was using the deprecated --link
option. Unfortunately, the documentation had not been updated on how to avoid this deprecated option. After removing the option, I searched online and modified my podman run
configuration numerous times, but after a few hours of frustration, I just wanted to run these two Docker containers again.
First, I didn't want to change my docker run
conf, so I could figure out if it was a podman or a general issue. It ran somehow. After preparing everything for testing on podman, why it didn't run there, both dockers went down (I don't know why; I didn't check the logs).
Anyhow, I started these two dockers again, and boom, nginx timeout (bad gateway). I checked the internal IPs of these dockers and found that they had somehow changed. I stopped and removed my docker, ran my conf, and still had a bad gateway. Weirdly, I checked the logs, and it still tried to receive MySQL on the old IP address.
Then I tried the old --link
option and it still didn't worked somehow.
But then I've got an idea, normally you should get somewhere a config file, like the gitea app.ini
, where everythings got saved like, database IP, database password and so on.
I looked up and found it.
The weird thing?
Docker never changed my conf File. That were the reason why it was unable to connect to my database.
I copied my MySQL DB and docker files to mysql-testing and docker-testing. Now I've changed the conf to the podman MySQL IP address, and it's also working on podman!
Currently, I'm running podman parallel to docker because my matrix server is still running on docker. Maybe you already noticed it, but it's an ansible script, and I'm still unsure if this would run with matrix.
Got 2 concerns about it:
- This Ansible script would check if the Docker service is running and start it if necessary.
- If you are using short names, you have to decide from where you want to get your container. I assume Ansible wouldn't know what to do and might encounter an error.
Anyway, it could be as easy as that. I'll try to set up a testing server where I can try this out.
My next goal is to take a closer look at Ansible and playbooks. These two goals will go hand in hand with the matrix Ansible playbook.
Once I have tested that the matrix Ansible playbook works with Podman, I will update this blog entry.
ressources:
Gthub issue podman-compose not working
The guide I used to get podman 4.x
The only info I got about using matrix-ansible playbook with podman