Fedora 40
Sponsored Link

Podman : Use External Storage (NFS)2024/05/03

This is an example to use NFS External Storage.
NFS server is required to be running on your LAN, refer to here.
On this example, configure [/home/nfsshare] directory on [nfs.srv.world] as a shared directory.
[2] Create a volume for NFS and use it.
# create [nfs-volume] volume

[root@dlp ~]# podman volume create \
--opt type=nfs4 \
--opt o=rw \
--opt device= nfs-volume 

# display volume list

[root@dlp ~]#
podman volume ls

local       nfs-volume

# display details of [nfs-volume]

[root@dlp ~]#
podman volume inspect nfs-volume

          "Name": "nfs-volume",
          "Driver": "local",
          "Mountpoint": "/var/lib/containers/storage/volumes/nfs-volume/_data",
          "CreatedAt": "2024-05-03T16:04:42.675722385+09:00",
          "Labels": {},
          "Scope": "local",
          "Options": {
               "device": "",
               "o": "rw",
               "type": "nfs4"
          "MountCount": 0,
          "NeedsCopyUp": true,
          "NeedsChown": true,
          "LockNumber": 8

# run container with mounting [nfs-volume] to [/nfsshare] on container

[root@dlp ~]#
podman run -it -v nfs-volume:/nfsshare fedora
# verify

[root@37f799f023c4 /]#
df -hT /nfsshare

Filesystem               Type  Size  Used Avail Use% Mounted on nfs4   15G  1.9G   14G  13% /nfsshare

[root@37f799f023c4 /]#
echo "Podman NFS Volume Test" > /nfsshare/testfile.txt

[root@37f799f023c4 /]#
cat /nfsshare/testfile.txt

Podman NFS Volume Test
Matched Content