简体   繁体   English

docker alpine 容器启动时挂载 webdav 共享

[英]Mount webdav share when docker alpine container starts

I have a setup with duplicity (backup software) running inside a docker (alpine) container.我有一个在 docker(高山)容器内运行的具有重复性(备份软件)的设置。 The destination is a local folder, which I have mounted as Webdav share.目标是一个本地文件夹,我已将其安装为 Webdav 共享。 The duplicity backup has a pre and post trigger, so I mount on pre and umount on post . duplicity 备份有一个 pre 和 post 触发器,所以我 mount on pre和 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 ETC

So my thought was: at start of the container, I directly mount the webdav share.所以我的想法是:在容器启动时,我直接挂载了 webdav 共享。 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.我的第一次尝试是在 /etc/fstab 中将noauto更改为auto That didn't work那没有用

My second attempt was reading into rc-service , but it seems openrc is removed from Alpine >= 3.3.我的第二次尝试是读入rc-service ,但似乎 openrc 已从 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.我的第三次尝试是阅读 init 系统,关于安装 openrc 或将--inittini一起使用,但在继续之前,我想在继续之前在这里提出这个问题。

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.我的出发点是我不想在主机上挂载 webdav 共享并将其作为卷挂载到我的 docker 容器中。 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?我应该如何进行?

I made an entry in /etc/fstab which mounts the share in a single command.我在/etc/fstab中创建了一个条目,它将共享安装在一个命令中。 With an entrypoint bash script, the share is mounted automatically.使用入口点 bash 脚本,共享会自动挂载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM