Open pcwilcox opened 11 months ago
I cannot reproduce the issue
$ docker volume create docs/
Error response from daemon: create docs/: "docs/" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path
I have the same docker version
Looks like it's a bug with the Ansible glusterfs volume plugin:
$ ansible localhost -m docker_volume -a "name='docs/' state=present driver=glusterfs driver_options='name=docs'"
localhost | CHANGED => {
"changed": true,
"volume": {
"CreatedAt": "0001-01-01T00:00:00Z",
"Driver": "glusterfs:latest",
"Labels": null,
"Mountpoint": "/var/lib/docker/plugins/cd674c4f9ea79201fb39ea3289e991b4eb27d11e1a179bc09e84d380be7a9d9d/rootfs",
"Name": "docs/",
"Options": {
"name": "docs"
},
"Scope": "local"
}
}
$ docker volume ls
DRIVER VOLUME NAME
glusterfs:latest docs/
$ docker volume ls --format json
{"Availability":"N/A","Driver":"glusterfs:latest","Group":"N/A","Labels":"","Links":"N/A","Mountpoint":"/var/lib/docker/plugins/cd674c4f9ea79201fb39ea3289e991b4eb27d11e1a179bc09e84d380be7a9d9d/rootfs","Name":"docs/","Scope":"local","Size":"N/A","Status":"N/A"}
Either way there should be some way to remove it, right?
In case anyone else runs into this exact problem, it seems that manually executing the ansible plugin with state=absent
does the job:
$ ansible localhost -m docker_volume -a "name='docs/' state=absent driver=glusterfs driver_options='name=docs'"
localhost | CHANGED => {
"actions": [
"Removed volume docs/"
],
"changed": true
}```
I also found that Swarmkit was able to remove it.
I cannot reproduce the issue
I think the devil is in the detail there; "invalid characters for a local volume name". ISTR that we restricted allowed names for local (built-in) volumes, but couldn't apply the same restrictions for volume-driver plugins as some plugins depended on special characters (or names containing slashes and other characters).
The daemon failing to remove this one may be related to an issue with gorilla/mux, which may strip the trailing hyphen when matching routes 🤔
Description
The CLI fails to remove docker volumes with trailing slashes. I inadvertently created a volume
docs/
and now cannot get rid of it. It's not used by any containers butdocker volume prune
silently fails to remove it, anddocker volume rm
fails with an error.Reproduce
docker volume create $NAME/
docker volume rm $NAME/
Expected behavior
docker volume rm $NAME
should remove the volume.docker volume prune -a
should remove the volume since it isn't in use.docker version
docker info
Additional Info
No response