Tag: docker

Migrating from Docker to Podman

I’ve been eyeing Podman for a while. Being able to build and run containers without the Docker daemon hanging around in the background as an omnipotent demigod sounds nice. Less stuff running = good. Installing it is trivial on Ubuntu (unlike installing Docker): apt-get install podman and it’s done. As the documentation states, it can even be aliased to docker to make migration even smoother. It has tons of features that I don’t think are there in Docker: generating Kubernetes YAMLs from running containers, using container LABELs to make run commands simpler and so on.

Which is all nice and it’s to stay for sure, but I had to realize that at this point this won’t have much of an effect on me (anymore). I hardly ever build container images locally, instead using some CI (Github Actions) to do it automatically. Not having to remember all the build options (even if just in .bash_history) is nice, and if I have to put it into code anyway, I might as well automate it completely.

As for running containers, podman run will be now my go-to for experimentation (instead of docker run). However, most of the time I use docker-compose to orchestrate a local development environment. It’s possible to use Podman’s system service to use docker-compose, but then is there much of a difference from running that and having the Docker daemon running? It’s also possible to use (simple) Kubernetes Pod/Service YAMLs to achieve something similar, and I’ll be sure to consider that the next time. But I don’t think I’ll make the effort to change these stuff for existing projects on my current computer. Not unless Docker kills free users altogether…

Collapse of the docker0 bridge

We’ve got a printer in the office. I’m not sure how the network is organized, but it’s on a different IP range than the rest of the dev network. And for some reason I couldn’t get it to work.

Mounting folders as Docker volumes

When trying to pass data between a Docker container and the host, using ADD in the Dockerfile might be sufficient at first. However, it’s one way, get burned in the image and so very inflexible.

The usual solution is to mount folders using docker‘s -v option. It’s simple, easy to use and pretty reliable. Just add -v "$(pwd):/root" and the current folder will be mounted to the /root folder in the container.

Using volumes is nice because they’re (can be) two way and (can) sync in real-time. Now you don’t need to rebuild your image every time you fix a typo. -v has pretty deep configuration options too, in case you want to go down the rabbit hole.