Depending on the amount of images and the size of each image, the backing storage requirements can grow quite large. I'll reconfigure podman to use a new mountpoint to use as backing storage for container images.
First, some disk-configuration is required. I'll be using logical volumes for easy volume management:
[root@podman02 ~]# pvcreate /dev/vdb
[root@podman02 ~]# vgcreate vg_data /dev/vdb
[root@podman02 ~]# lvcreate -n lv_var_podman -L 20G
[root@podman02 ~]# mkfs -t xfs /dev/vg_data/lv_var_podman
[root@podman02 ~]# cat << EOF >> /etc/fstab
/dev/vg_data/lv_var_podman /var/podman xfs defaults 0 0
EOF
[root@podman02 ~]# systemctl daemon-reload
[root@podman02 ~]# mount -a
Now, let's reconfigure the storage setting for a user. I'll be using my user as an example.
[root@podman02 ~]# mkdir -p -m 750 /var/podman/archy
[root@podman02 ~]# chown -R archy:archy /var/podman/archy
[root@podman02 ~]# sudo -Hiu archy
[archy@podman02 ~]$ mkdir -p -m 750 ~/.config/containers/
[archy@podman02 ~]$ cat << EOF >> ~/.config/containers/storage.conf
[storage]
driver = "overlay"
graphroot = "/var/podman/archy"
EOF
The Configuration should be present now. As a last step, we need to configure SELinux on EL Based platforms. There is a reference already present which can be used:
[root@podman02 ~]# semanage fcontext -a -e /var/lib/containers/storage /var/podman/archy
[root@podman02 ~]# restorecon -rv /var/podman
Podman will now use the new storage backend.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment