TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
182 stars 49 forks source link

docker volume driver_opts are not being saved upon provisioning #152

Open teutat3s opened 4 years ago

teutat3s commented 4 years ago

When provisioning a volume in a custom fabric network the tritonnfs driver Options show null instead of the configured network.

docker --version
Docker version 19.03.11-ce, build 42e35e61f3

PI: 20200103T034110Z sdc-docker image: docker release-20200102-20200103T002424Z-g3faf7f9 sdc-volapi image: volapi release-20200102-20200103T005353Z-g5210f51

Steps to reproduce (with the triton docker API):

docker volume create --name testvol --opt network=vol-test-fabric
docker volume inspect testvol

The output should look like this:

[
    {
        "Driver": "tritonnfs",
        "Labels": null,
        "Mountpoint": "192.168.10.6:/exports/data",
        "Name": "testvol",
        "Options": null,
        "Scope": ""
    }
]

Came across this when using docker-compose with a docker-compose.yml like this:

version: '2.1'

services:
  ...

volumes:
    testvol:
       driver: tritonnfs
       name: testvol
       driver_opts:
         network: vol-test-fabric

Creation of the volume worked fine and it was placed in the correct fabric network after the initial

docker-compose up -d

But upon the second try, docker-compose up -d gave this error message:

ERROR: Configuration for volume testvol specifies "network" driver_opt vol-test-fabric, but a volume with the same name uses a different "network" driver_opt (None). If you wish to use the new configuration, please remove the existing volume "testvol" first:
$ docker volume rm testvol