Fedora 33
Sponsored Link

Podman : Use External Storage
When Container is removed, data in it are also lost, so it's necessary to use external storage on Container if you need.
[1] It's possible to mount a directory on Container Host into Containers as a external storage.
# create a directory

[root@dlp ~]#
mkdir -p /var/lib/containers/disk01

# run container with mounting the directory on /mnt

# if SELinux is [Enforcing], needs [--privileged] option like follows

[root@dlp ~]#
podman run --privileged -it -v /var/lib/containers/disk01:/mnt fedora /bin/bash
[root@cb71fba422da /]#
df -hT

Filesystem                     Type     Size  Used Avail Use% Mounted on
overlay                        overlay   78G  3.4G   75G   5% /
tmpfs                          tmpfs     64M     0   64M   0% /dev
/dev/mapper/fedora_fedora-root xfs       78G  3.4G   75G   5% /mnt
shm                            tmpfs     63M     0   63M   0% /dev/shm
tmpfs                          tmpfs    2.4G  1.2M  2.4G   1% /etc/hosts

[root@cb71fba422da /]#
echo "persistent storage" >> /mnt/testfile.txt

[root@cb71fba422da /]#
[root@dlp ~]#
cat /var/lib/containers/disk01/testfile.txt

persistent storage
Matched Content