docker_volume cannot provision nfs resource correctly
Cookbook version
2.15.27
Chef-client version
2.1.11
Platform Details
RedHat 7.3 Docker version 1.12.6, build 0fdc778/1.12.6
Scenario:
Create docker_volume with options
Steps to Reproduce:
docker_volume 'node1_config' do driver 'local' opts ['type=nfs', "o=addr=#{nfsserver},rw", "device=:#{vol_name}/node1"] action :create end
The resource above should be equivalent to:
docker volume create --driver local --opt type=nfs --opt o=addr=10.0.0.59,rw --opt device=:vol_node1/node1 --name node1_config
Expected Result:
docker volume is created with the local driver and options:
docker volume inspect node1_config
[
{
"Name": "node1_config",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/node1_config/_data",
"Labels": {},
"Scope": "local"
}
]
Actual Result:
[ { "Name": "node1_config", "Driver": "local", "Mountpoint": "/var/lib/docker/volumes/node1_config/_data", "Labels": null, "Scope": "local" } ]
Here is more details:
[root@dockernode01 volumes]# ls -al node1_config/
total 4
drwxr-xr-x. 3 root root 18 Sep 6 10:07 .
drwx------. 6 root root 4096 Sep 6 10:14 ..
drwxr-xr-x. 2 root root 6 Sep 6 10:07 _data
[root@dockernode01 volumes]# ls -al node2_config/
total 8
drwxr-xr-x. 3 root root 34 Sep 6 09:04 .
drwx------. 6 root root 4096 Sep 6 10:14 ..
drwxr-xr-x. 2 root root 6 Sep 6 09:04 _data
---x--x---. 1 root root 99 Sep 6 09:04 opts.json
Looks like the one "node1_config" created by the docker-api doesn't have 'opts.json' file compare to the one created by the normal docker command line "node2_config":
docker volume create --driver local --opt type=nfs --opt o=addr=10.0.0.59,rw --opt device=:vol_node1/node2 --name node2_config
Here is the content of the 'opts.json' file:
{"MountType":"nfs","MountOpts":"addr=10.0.0.59,rw","MountDevice":": vol_node1/node2"}
Looks like it's not the cook book's issue, it's more like API issue. I used the docker-api directly from irb to test, still same result. Haven't check the docker remote API yet. Will check this tomorrow.
Thanks for the update. If you can let us know when it gets fixed upstream that would be really helpful (especially if it continues to be an issue with the cookbook).