---
layout: post
title: From docker to podman in less than 10 minutes
date: 2020-05-02
tags:
   - docker
   - podman
lang: en
## Make sure to change these
published: true
sitemap: true
---

I switched from Ubuntu to Fedora in my personal laptop a few months ago,
also about the same time I installed Red Hat Enterprise Linux 8 as guest
on Hyper-V for my job.

One of the first things I noticed was the lack of support for Docker and
going full with Kubernetes and OpenShift, which means no real need for
Docker. Currently almost all my work is run in Docker containers,
therefore I was glad to know that Podman is a direct replacement for
Docker.

The Pod Manager tool `podman` is a container engine, just like Docker,
but without the requirement of a service daemon running all the time. It
is supported by Red Hat and all the operating system relatives, such as
Fedora and CentOS.  It shares all `docker` sub-commands plus a few
others. For more information read the [podman's manual
pages](https://github.com/containers/Demos/tree/master/building/buildah_intro).

`podman` talks directly to the image registry, the container and image
storage, and with the Linux kernel through the runC container runtime
process (not a daemon). Podman stores its containers and images in
different places than Docker, each user has its own
`.local/share/containers` directory, which allows to several user to use
Podman concurrently. Podman an Docker images are compatible.  Podamn
allows to work with Kubernetes.

## How I did it?

Make sure to have the latest updates for your operating system first,
then install `podman` which is available by default in Fedora 31 and
later releases.

```bash
sudo dnf update -y
sudo dnf install podman -y
```

Remove by hand the images you don't want to migrate, old images,
dangling intermediate build images, test, you know, anything that's a
waste of storage space. And then iterate through the Docker images and
pull them into Podman.

```bash
{% raw %}
for img in $(docker images --format '{{.Repository}}:{{.Tag}}'); \
do
echo $img; podman pull docker-daemon:$img; \
done
{% endraw %}
```

Review your images with `podman`, just like you'll do with `docker`.

```bash
podman images
```

Now you're ready to get rid of Docker. Stop the daemon, uninstall the
package, delete directories that could use space and drop the `docker`
user group.

```bash
docker system prune -a --volumes
sudo systemctl stop docker
sudo systemctl disable docker
sudo dnf remove moby-engine
sudo rm -rf /var/lib/docker /var/run/docker
sudo rm -rf /etc/docker ~/.docker
sudo groupdel docker
```

If you're running CentOS or actual Red Hat Enterprise Linux, the install
steps will change a bit.


## Now what?

So far I haven't had major issues using Podman, however there are some
bumps. For example, I use `docker-compose` in several projects for
development, I know there is something called [`podman-compose`](),
which I need to review.

Some CI/CD pipelines in my projects expect the `docker` command, I
haven't make my mind to change that, as I said images are compatible,
but I'd like to use the same tools all along the pipeline, I want to
avoid doing `alias podman=docker`.

[Podman and Buildah for Docker user](https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/) is a good read for starters.