The current container migration implementation in Podman cannot handle
changes to the file-system.
If a container changes a file the recommendation is to mount that
directory as a tmpfs and then the changed file will be correctly
migrated to the destination system. If something changes a file in /tmp
for example, following steps are currently necessary:
# podman run -d --tmpfs /tmp <container>
# podman container checkpoint -l -e /tmp/chkpt.tar.gz
# scp /tmp/chkpt.tar.gz destination-host:/tmp
On the destination host of the migration:
# podman container restore -i /tmp/chkpt.tar.gz
Files changed in /tmp in the container will also be in the restored
container on the destination host, because CRIU automatically handles
tmpfs directories.
To make it easier for users to not have to mark all changed directories
as --tmpfs I would like to include changed files in the checkpoint
archive (/tmp/chkpt.tar.gz from my example).
One possible implementation could use
vendor/github.com/containers/storage/store.go:
// Diff returns the tarstream which would specify the changes returned
// by Changes. If options are passed in, they can override default
// behaviors.
Diff(from, to string, options *DiffOptions) (io.ReadCloser, error)
This sounds exactly like what I need. I get a tarstream which I can
embed into the checkpoint archive and which can then be used with
ApplyDiff() before restoring the container.
Does this sound like the right approach to also migrate file-system
changes during container migration?
Adrian