moby: Unable to remove volume when container creation fails
Output of docker version:
$ docker version
Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 18:22:26 2016
 OS/Arch:      linux/amd64
Server:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 18:22:26 2016
 OS/Arch:      linux/amd64
Output of docker info:
$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 3
Server Version: 1.11.0
Storage Driver: devicemapper
 Pool Name: docker-thinpool
 Pool Blocksize: 524.3 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file:
 Metadata file:
 Data Space Used: 502.3 MB
 Data Space Total: 8.338 GB
 Data Space Available: 7.836 GB
 Metadata Space Used: 299 kB
 Metadata Space Total: 641.7 MB
 Metadata Space Available: 641.4 MB
 Udev Sync Supported: true
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Library Version: 1.02.120 (2016-03-11)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge null host
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux stretch/sid
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.963 GiB
Name: localdev
ID: 2GH4:KUEP:Q5HH:I6T7:KZM6:2AOC:MA5S:QSVV:FJ72:IPR5:7ABX:4MR2
Docker Root Dir: /data/docker/devicemapper-thin
Debug mode (client): false
Debug mode (server): false
Username: mbentley
Registry: https://index.docker.io/v1/
WARNING: No kernel memory limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Additional environment details (AWS, VirtualBox, physical, etc.): Debian Sid running in VirtualBox
Steps to reproduce the issue:
- 
Try to create a container with multiple volumes but try to mount them to the same location in the container (which will fail):
$ docker run -d -v test:/data -v test2:/data alpine sh docker: Error response from daemon: Duplicate mount point '/data'. See 'docker run --help'. - 
Try to remove the volume that was created:
$ docker volume ls DRIVER VOLUME NAME local test $ docker volume rm test Error response from daemon: Unable to remove volume, volume still in use: remove test: volume is in use - [ac641c4577bc210e6ed41c8a580074300de7d342e5f78332cbdd71532b11ab0c] - 
The mentioned container doesn’t exist:
$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 
Describe the results you received:
$ docker volume rm test
Error response from daemon: Unable to remove volume, volume still in use: remove test: volume is in use - [60fb24fdee552e54d0b884592ee616277c7c14eb8c2f2d6e4b7e53c36f531c04]
Describe the results you expected: Volume should be removable as it isn’t in use by a container
Additional information you deem important (e.g. issue happens only occasionally): If you restart the daemon, you can remove the volume but that should not be necessary
About this issue
- Original URL
 - State: closed
 - Created 8 years ago
 - Reactions: 4
 - Comments: 17 (11 by maintainers)
 
@nottrobin you can use the
--filteroption ondocker ps, for example, this example shows all containers that are using thefoovolume:See the documentation here: https://docs.docker.com/engine/reference/commandline/ps/#/volume