CentOS 8
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 centos /bin/bash
[root@ecb1c14afb13 /]#
df -hT

Filesystem          Type     Size  Used Avail Use% Mounted on
overlay             overlay   75G  2.8G   73G   4% /
tmpfs               tmpfs     64M     0   64M   0% /dev
/dev/mapper/cl-root xfs       75G  2.8G   73G   4% /mnt
tmpfs               tmpfs    8.9G  8.6M  8.9G   1% /etc/hosts
shm                 tmpfs     63M     0   63M   0% /dev/shm
tmpfs               tmpfs    8.9G     0  8.9G   0% /sys/fs/cgroup

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

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

persistent storage
Matched Content