Migrating from Docker to Podman: A Step-by-Step Guide

How to migrate volumes Get the path of each volume from Docker #List all your volumes docker volume ls #For each volume docker volume inspect my_volume #Then keep the Mountpoint path "Mountpoint": "/var/lib/docker/volumes/mon_volume/_data" Recreate your volume in Podman podman volume create my_volume # Get the path volume podman volume inspect mon_volume_podman # Example "Mountpoint": "/home/dev/.local/share/containers/storage/volumes/mon_volume_podman/_data" Then copy your docker volume to the podman volume #The /. at the end is important, keep it sudo cp -a /var/lib/docker/volumes/my_volume/_data/. /home/dev/.local/share/containers/storage/volumes/my_volume_podman/_data/ How to migrate images I recommend to push your image in a registry, but if you want transfert it manually, you can do this : #List your images docker images #Then to export your image docker save -o my_image.tar my_image:latest #To import into podman podman load -i my_image.tar #Check your image is imported podman images How to migrate containers You can reproduce the command run with podman, nether less you need to transfert the volumes. You can list all the volumes used with this command docker inspect my_app | grep Mounts -A 20 You can also create a snapshot, a image from you container, like this docker commit my_app my_app_image docker save -o my_app_image.tar my_app_image Remove Docker sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo rm -rf /var/lib/docker Create an alias Docker for Podman echo "alias docker=podman" >> ~/.bashrc source ~/.bashrc

Apr 20, 2025 - 09:32
 0
Migrating from Docker to Podman: A Step-by-Step Guide

How to migrate volumes

Get the path of each volume from Docker

#List all your volumes
docker volume ls

#For each volume
docker volume inspect my_volume

#Then keep the Mountpoint path 
"Mountpoint": "/var/lib/docker/volumes/mon_volume/_data"

Recreate your volume in Podman

podman volume create my_volume
# Get the path volume
podman volume inspect mon_volume_podman
# Example 
"Mountpoint": "/home/dev/.local/share/containers/storage/volumes/mon_volume_podman/_data"

Then copy your docker volume to the podman volume

#The /. at the end is important, keep it
sudo cp -a /var/lib/docker/volumes/my_volume/_data/. /home/dev/.local/share/containers/storage/volumes/my_volume_podman/_data/

How to migrate images

I recommend to push your image in a registry, but if you want transfert it manually, you can do this :

#List your images
docker images
#Then to export your image
docker save -o my_image.tar my_image:latest
#To import into podman 
podman load -i my_image.tar
#Check your image is imported
podman images

How to migrate containers

You can reproduce the command run with podman, nether less you need to transfert the volumes.
You can list all the volumes used with this command

docker inspect my_app | grep Mounts -A 20

You can also create a snapshot, a image from you container, like this

docker commit my_app my_app_image
docker save -o my_app_image.tar my_app_image

Remove Docker

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo rm -rf /var/lib/docker

Create an alias Docker for Podman

echo "alias docker=podman" >> ~/.bashrc
source ~/.bashrc