Docker Community Forums

Share and learn in the Docker community.

Where are volumes located on OS X?


(Jens Peter Secher) #1

Let’s say I have a docker-compose.yml that creates a data volume and a database that uses the volume like this:

services:
  db:
    container_name: forum-db
    build: mongodb
    volumes_from:
      - db-data
  db-data:
    container_name: forum-db-data
    image: busybox
    volumes:
      - /data/forum-mongodb:/data/db

where is /data/forum-mongodb located on OS X and/or how to I delete the contents?


(David Maze) #2

docker volume ls will list all of the data volumes, docker volume rm will remove them. Another rolls-off-the-fingers shell fragment I use routinely:

docker volume ls -q | xargs docker volume rm

docker rm -v will remove volumes started with a container. docker-compose rm -v is the same thing in Compose syntax.

In general, you don’t know where Docker is storing things and shouldn’t need to know in detail. On the OS X beta, I think all of the storage is somewhere under ~/Library/Containers/com.docker.docker (and I’ve seen mention of a big qcow2 file in other forum posts); Docker Machine stores them in ~/.docker/machine (again, in a big opaque VM image file); classic Linux in /var/lib/docker unless reconfigured.


(Jens Peter Secher) #3

Thanks, you are right, there is a huge Qemu Image under ~/Library/Containers/com.docker.docker, which is not easy to work with :-/

I had already removed all containers, all images, and all volumes, but the contents of the volume kept coming back. Then I discovered that somehow the docker containers were still running, because I could communicate with them though locahost!

I fixed the problem by rebooting the machine. I suspect that the update from Docker for Mac beta8 to beta9 somehow kept old containers running. Now everything works fine.


(Cyber) #4

Just complementing for Google parachuters.
I was seeing some weird-looking-non-existent paths on docker volume inspect output.
Then I realized since I was using docker-machine to isolate my images and containers on a VMWare vm I ssh’ed to it and lo and behold, that’s where the “weird” paths were.