Removing Docker volume when container is in use
You started looking the volumes:user@ubuntu:~$ docker volume lsDRIVER VOLUME NAMElocal d 2026-5-29 13:51:55 Author: acassis.wordpress.com(查看原文) 阅读量:3 收藏

You started looking the volumes:

user@ubuntu:~$ docker volume ls

DRIVER VOLUME NAME

local docker-lab_postgres_data

local b1aa150eb6ddb45084ff2b4554394c100c59a41c...

local client_postgress_db

local client_container_data

Then you try to remove:

user@ubuntu:~$ docker volume rm client_postgress_db

Error response from daemon: remove client_postgress_db: volume is in use - [553052b480de56abf196c34182780f1a86d35cdab989c15475e470ba7a67edee]

The solution is listing all containers, filtering by volume:

user@ubuntu:~$ docker ps -a --filter volume=client_postgress_db

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

553052b480de telix:1.0 "start-system.sh" 7 hours ago Exited (137) 6 hours ago client-app-1

Then remove the container:

user@ubuntu:~$ docker rm 553052b480de

553052b480de

And finally remove the volume:

user@ubuntu:~$ docker volume rm client_postgress_db

client_postgress_db

user@ubuntu:~$


文章来源: https://acassis.wordpress.com/2026/05/29/removing-docker-volume-when-container-is-in-use/
如有侵权请联系:admin#unsafe.sh