I wanted to switch my local container development tool from docker to podman. The reason is that podman uses pods to link containers together, and the pod specification used is the kubernetes pod specification, making transistioning the apps to Kubernetes easier.
Remove docker
I could not remember how I installed docker so I followed this guide how-to-completely-uninstall-docker.
I ran the command dpkg -l | grep -i docker
.
This returned
ii docker-buildx-plugin 0.11.2-1~ubuntu.20.04~focal amd64 Docker Buildx cli plugin.
ii docker-ce 5:24.0.7-1~ubuntu.20.04~focal amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:24.0.7-1~ubuntu.20.04~focal amd64 Docker CLI: the open-source application container engine
ii docker-ce-rootless-extras 5:24.0.7-1~ubuntu.20.04~focal amd64 Rootless support for Docker.
ii docker-compose-plugin 2.21.0-1~ubuntu.20.04~focal amd64 Docker Compose (V2) plugin for the Docker CLI.
I than ran sudo apt-get purge -y
and sudo apt-get purge -y
on each of the packages above. Then ran the following commands.
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
sudo rm -rf /var/lib/containerd
sudo rm -r ~/.docker
Install podman
Using the podman documentation I ran the command sudo apt-get -y install podman
From there I ran the commands to check if podman was installed.
$ podman version
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.18.1
Built: Thu Jan 1 01:00:00 1970
OS/Arch: linux/amd64
When running docker commands the following was returned
$ docker ps
Command 'docker' not found, but can be installed with:
sudo snap install docker # version 24.0.5, or
sudo apt install podman-docker # version 3.4.4+ds1-1ubuntu1.22.04.2
sudo apt install docker.io # version 24.0.5-0ubuntu1~22.04.1
See 'snap info docker' for additional versions.
However after using docker for a number of years, and the muscle memory kicking in, it would be useful to still be able to use the docker command. Luckily there is a package that can help with this sudo apt-get -y install podman-docker
will install a docker emulator.
So running a docker command will now give you this.
$ docker ps
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
And as the result suggests you can switch of the message.
$ sudo touch /etc/containers/nodocker
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Word of caution, this approach did mean that I lost all local images and containers that I had on my system, so make sure you have saved everything you need prior to making the change.
Hope this helps! I hope to publish more articles about developing apps with podman in the near future.
Top comments (0)