Docker to Podman

Posted on Feb 17, 2024

Motivation

Containerization has become a common practise of modern software development; Docker has been a popular choice for container orchestration, however, as the field evolves, new tools emerge.

One of those is Podman; one of the premises of it is that it does not require a daemon, unlike docker (dockerd).

This is one of the many more reasons people are starting to migrate to podman.

For more information I recommend reading: https://docs.podman.io/en/latest/

Install Podman

https://podman.io/docs/installation

Identify Existing Containers

$ docker container ls -a

Export Docker container to a Tarball

To import your Docker container into Podman you will need to export a tarball containing the filesystem of the container:

$ docker export your_container_name > your_container_name.tar

Import Docker container into Podman

Now that you have the tarball, you can import it into Podman:

$ podman import your_container_name.tar

Check Imported Images

Verify that your Docker container has been successfully imported into Podman:

$ podman images

(Optional) Rename Imported Image

If you want to assign a name for the imported image:

$ podman tag <imported_image_id> your_container_name

(Optional) Remove Dangling Docker containers and images

If you wish to remove all Docker containers and images at once, after converting them to Podman:

$ docker container prune
$ docker image prune

Start Podman Container

For example:

$ podman run -d --name your_container_name -p 8080:80 your_container_name