Suppose I have a volume and I know its name or id.
I want to determine the list of containers (their names or ids) that use the volume.
What commands can I use to retrieve this information?
I thought it can be stored in the output of docker volume inspect <id>
command but it gives me nothing useful other than the mount point ("/var/lib/docker/volumes/<id>"
).
docker ps
can filter by volume to show all of the containers that mount a given volume:
docker ps -a --filter volume=VOLUME_NAME_OR_MOUNT_POINT
Reference: https://docs.docker.com/engine/reference/commandline/ps/#filtering