According to the official documentation it is possible to "force" remove a volume. The documentation remains quite unspecific what is meant by --force. To what I have found so far in the web this implicates the removal of volumes that are still in use by other containers.

Using the --force option appears to have no impact:

$ docker volume create mydata
$ docker docker run -v mydata:/mydata alpine:latest /bin/sh -c "touch /mydata/mydata.test; ls /mydata"
$ docker volume rm --force mydata
Error response from daemon: unable to remove volume: remove mydata: volume is in use - [1cbcfa3d47a32db7b0075e113216f7146a436a4da22a97dc2f7b60c68de95c3d]

This is the same output as when omitting the --force flag. Is this a bug or am I misunderstanding something?

$ docker version
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:09:13 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:07:43 2018
  OS/Arch:      linux/amd64
  Experimental: false

4 Answers 4


I am annoyed by all answers on all posts which do NOT provide a solution for the case which is mentioned by OP: The --force flag DOES NOT HELP.

Workaround (ATTENTION, you really should know what you do!):

docker volume ls # To list the volumes which currently exist

# To get the absolute path to the directory on your system where docker
# actually stores this volume
docker volume inspect --format '{{ .Mountpoint }}' <volume-name> 

# E.g. sudo rm -rf /var/lib/docker/volumes/database_volume (without the 
# _data directory)
sudo rm -rf <path-from-above> 

# Needed so docker will reload its volumes-directory to no longer list the
# deleted volume under docker volume ls and no longer make headaches on any
# build- or run-attempts.
sudo service docker restart 
  • 2
    Thanks. This is indeed a "hardcore" way to get rid of the data. So far I have not found any official way to force remove a data countainer attached to a NOT RUNNING parent container. The replies above did not address my question at all.
    – Ranunculum
    Nov 29, 2018 at 10:30
  • Yea me too on the annoyed. I had a volume that was listed as dangling (no associated container) but refused! to be pruned even with --force. This was the ONLY way to get rid of it.
    – DKebler
    Mar 3 at 22:59

use the --filter flag to see which containers are using the volume:

docker ps --filter volume=mydata

then, stop the container that is using that volume.

Finally, remove the volume if you wish to do so:

docker volume rm --force mydata
  • 1
    I know that this is the normal workflow to stop/remove the containers (that are attached with the volume) first. But what if I want to delete the volume even if it is still attached to a not running container? The definition of the --force option is not clear. In your second command, the --force option is basically useless.
    – Ranunculum
    Jan 17, 2018 at 16:20
  • rm removes the reference to the data volume. the --force switch grabs the main process inside the container referenced under the link mydata. The datavolume will then receive SIGKILL, then the data volume will be removed. This works the same with containers. Also, try using docker rm -v mydata to remove the volume. (this will remove the container and its volume.) Jan 17, 2018 at 16:31
  • Sorry, but I still don't understand this: When I run docker docker run -v mydata:/mydata alpine:latest /bin/sh -c "touch /mydata/mydata.test; ls /mydata" this will imediately stop the container after the last command ls /mydata was executed. There is no container running to receive SIGKILL. The container is not running. But the volume cannot be removed, even when providing --force. So what is --force then good for?
    – Ranunculum
    Jan 18, 2018 at 8:30
  • The docker volume rm already shows which container is referencing the volume: the 1cbcfa3d47a32db7b0075e113216f7146a436a4da22a97dc2f7b60c68de95c3d in the error message is the container ID. Also stopping the container is not sufficient, the container has to be removed. See this issue on GitHub.
    – Martin
    Jan 10, 2023 at 20:55

In my experience, the -f flag makes the command not to fail if the volume does not exists. This is similar to how the classic rmcommand works.

This is useful if the command is executed inside scripts.


docker volume rm will not let you remove a volume still referenced by a container, even if the container is stopped and you use the --force parameter.

The error message tells you which container has to be removed in order to be able to remove the volume. In your case it’s the container with the ID 1cbcfa3d47a32db7b0075e113216f7146a436a4da22a97dc2f7b60c68de95c3d.

See this issue on GitHub for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .