Fedora 32
Sponsored Link

Podman : Use External Storage2020/05/11

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@39ae951f8faa /]#
df -hT

Filesystem              Type     Size  Used Avail Use% Mounted on
overlay                 overlay   15G  2.9G   13G  19% /
tmpfs                   tmpfs     64M     0   64M   0% /dev
/dev/mapper/fedora-root xfs       15G  2.9G   13G  19% /mnt
shm                     tmpfs     63M     0   63M   0% /dev/shm
tmpfs                   tmpfs    5.9G  1.3M  5.9G   1% /etc/hosts

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

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

persistent storage
Matched Content