Search code examples
dockerinitwebdavalpine-linuxduplicity

Mount webdav share when docker alpine container starts


I have a setup with duplicity (backup software) running inside a docker (alpine) container. The destination is a local folder, which I have mounted as Webdav share. The duplicity backup has a pre and post trigger, so I mount on pre and umount on post. However, this doesn't cover all my use cases since:

  1. The restore doesn't include the pre/post triggers
  2. Validation doesn't work
  3. Listing files in the destination folder doesn't work
  4. etc

So my thought was: at start of the container, I directly mount the webdav share. The mount is active for the entire runtime of the container, instead of only during backup, but that doesn't matter. Stop the container and the share will umount.

My first attempt, was to change noauto to auto in /etc/fstab. That didn't work

My second attempt was reading into rc-service, but it seems openrc is removed from Alpine >= 3.3.

My third attempt was reading into init systems, about installing openrc or to use --init with tini, but before going further, I'd like to pose this question here before I continue.

My starting point is I'd like not to mount the webdav share on the host and mount it as a volume to my docker container. All the user configs should be inside a container. But I'd like to create some kind of init system somehow. How should I proceed?


Solution

  • I made an entry in /etc/fstab which mounts the share in a single command. With an entrypoint bash script, the share is mounted automatically.