docker build -t docker-volume-drbd .
 id=$(docker create docker-volume-drbd true)
 docker export $id -o img.tar

解压到rootfs

scp.sh `pwd`/drbd_plugin /home/ubuntu 

docker plugin create drbd ./drbd_plugin

docker plugin enable test

docker volume create -d test -o sshcmd=mhc@1111:pppp -o password=123 testvolume

ubuntu@9f8967ee-e741-4638-9c93-d88f37e2ec01:~/plugin_test$ docker volume ls
DRIVER              VOLUME NAME
test:latest         testvolume

Run 'docker volume COMMAND --help' for more information on a command.
ubuntu@9f8967ee-e741-4638-9c93-d88f37e2ec01:~/plugin_test$ docker volume inspect testvolume
[
    {
        "Driver": "test:latest",
        "Labels": {},
        "Mountpoint": "/mnt/volumes/ea700c1b8e3d0add8de24006225f52da",
        "Name": "testvolume",
        "Options": {
            "password": "123",
            "sshcmd": "mhc@1111:pppp"
        },
        "Scope": "local"
    }
]

 scp drbd-docker-plugin 109.105.7.96:/tmp && ssh 109.105.7.96 scp /tmp/drbd-docker-plugin ubuntu@109.105.30.106:/home/ubuntu

docker run -d -v test1:/test registry.bst-1.cns.bstjpc.com:5000/debian:jessie bash -c "while true;do echo haha >> /test/a.txt;sleep 5;done"
docker rm $(docker ps -qa) && docker volume rm test1 && docker plugin disable drbd && docker plugin rm drbd
docker plugin create drbd ./drbd_plugin && docker plugin enable drbd && cat ./log/test.log && docker volume create -d drbd test1

 

docker run -ti --rm --volume-driver=test2 -v haha2:/test registry.bst-1.cns.bstjpc.com:5000/debian:jessie bash