TransWikia.com

The path to docker's volumes in Ubuntu

Ask Ubuntu Asked by Transcendent on December 7, 2020

I’m both new to Ubuntu and Docker. I cut to the chase, when I create a volume using the sudo docker volume create TEST command, where should I expect to find the TEST volume and its data in my hard drive?

If I want it to be located in another drive, lets say D: (still new to ubuntu not sure if it also applies to linux) drive, what do I have to do?

3 Answers

Looks like it is /var/lib/docker/volumes

Here's what I got:

$ docker volume create TEST 
$ ls /var/lib/docker/volumes
metadata.db  TEST/

Correct answer by theferrit32 on December 7, 2020

Use docker volume inspect TEST (docs), and there will be a key "Mountpoint" with the path to it:

$ docker volume inspect TEST
[
    {
        "CreatedAt": "2020-09-18T10:46:55-07:00",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/TEST/_data",
        "Name": "TEST",
        "Options": {},
        "Scope": "local"
    }
]

To extract just the path, for example to use in a script:

$ docker volume inspect --format '{{ .Mountpoint }}' TEST
/var/lib/docker/volumes/TEST/_data

Answered by Davor Cubranic on December 7, 2020

If you're working on WSL2 through Docker Desktop for Windows, volumes will be found here:

/var/data/docker-desktop/default/daemon-data

If you are working on actual Ubuntu, then yes, as the above answer said it will be located in

/var/lib/docker/volumes

Answered by hashd on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP