23.05 Podman Migration – Preserving Volumes

According to the NixOS 23.05 release notes, podman users must run podman system reset --force before upgrading, deleting all “local containers, images, volumes”. However, I (and I am sure others) have state on podman volumes that needs to be preserved (configuration, sqlite databases, etc.). Is there a recommended migration route for users in my position?

2 Likes

Possible (untested) solution: export every volume with podman export volume. Reset podman, upgrade to 23.05, import volumes with podman import volume.

2 Likes

pinging podman maintainers I can find on discourse: @adisbladis @vdemeester @marsam

1 Like

You should be able to:

  1. Stop all podman containers
  2. podman volume export <volume> | <volume>.tar for each volume
  3. podman system reset
  4. nixos-rebuild switch --upgrade. Expect some failures because the containers may not start correctly.
  5. podman volume create <volume> && podman volume import <volume> <volume>.tar for each volume
  6. Restart podman services.

I put my /var/lib/containers/storage/volumes directory in a zfs dataset, so was able to stop services, snapshot the dataset, reset podman, nix upgrade, zfs rollback that dataset and continue on.