为Docker volume plugin 增加自动启动Service

涉及到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.

装上去后还是很不错,可以使用nfs进行共享卷的挂载了,还能备份、快照等操作。

但是默认daemon不是后台运行,每次使用或者重启都要手工启动,所以需要在ubuntu1604下新建一个service,并能开机自动启动,方便使用。

步骤如下:

1. 新建service的配置文件

$ sudo vi /etc/systemd/system/convoy.service

把下面的内容放进去,注意:最后一句/mnt/nfs,根据你自己的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

你可能感兴趣的:(为Docker volume plugin 增加自动启动Service)