Well I digged Podman documentation and I found a recipe that should work for any rootless module, more or less.
I assume the disk where we want to store the module data has been already formatted, configured in /etc/fstab
and mounted on /mnt/disk00
In general, after installation (creation) module instances are in a stopped state. They require an additional configuration step to start. In this state they still have not created the volumes where persistent data is stored.
In this case, it is possible to create the expected volume in advance, providing the configuration that bind-mounts an arbitrary path of the node.
Let’s make an example with Dokuwiki. When it is started for the first time it creates a dokuwiki-data
volume. Let’s bind it to /mnt/disk00
.
# module must have full access to the disk, like its home directory:
chown dokuwiki1:dokuwiki1 /mnt/disk00
chmod 700 /mnt/disk00
# create the named volume, with the name Dokuwiki wants
runagent -m dokuwiki1 podman volume create --opt=device=/mnt/disk00/ --opt=type=bind dokuwiki-data
Now complete the configuration of Dokuwiki from the UI as usual.
It seems straightforward so far, but what happens if I have data in the disk and I want to attach it to the container? For instance, data coming from another Dokuwiki?
In this case there can be a disalignment of uid/gid numbers in the filesystem and a full remap of files ownership is required. This is a common problem with containers because of uid/gid namespaces and it is an open issue in this scenario