涉及到systemd
的知識:
使用的是https://github.com/rancher/convoy
Convoy is a Docker volume plugin for a variety of storage back-ends. It's designed to be a simple Docker volume plug-ins that supports vendor-specific extensions such as snapshots, backups and restore. It's written in Go and can be deployed as a standalone binary.
裝上去后還是很不錯(cuò),可以使用nfs進(jìn)行共享卷的掛載了,還能備份、快照等操作。
但是默認(rèn)daemon不是后臺運(yùn)行,每次使用或者重啟都要手工啟動,所以需要在ubuntu1604下新建一個(gè)service,并能開機(jī)自動啟動,方便使用。
步驟如下:
1. 新建service的配置文件
$ sudo vi /etc/systemd/system/convoy.service
把下面的內(nèi)容放進(jìn)去,注意:最后一句/mnt/nfs,根據(jù)你自己的nfs目錄修改。
[Unit]
Description=Convoy Daemon
Requires=docker.service
[Service]
ExecStart=/usr/local/bin/convoy daemon --drivers vfs --driver-opts vfs.path=/mnt/nfs
[Install]
WantedBy=multi-user.target
2. 重新加載配置文件
sudo systemctl daemon-reload
3. 啟用service
sudo systemctl enable convoy
4. 啟動service
sudo systemctl start convoy.service