You need to keep in mind that Docker is still running inside a VM. The system paths are still relative to the VM, and not to your Mac.
Only some folders are already mounted from your Mac into the VM. You can get an overview by running this command:
$ docker run --rm -it -v /:/vm-root alpine:edge ls -l /vm-root
Regarding shared thread, I think I need to wait next version of Docker so that I can decide how to backup or which I should backup. Looks like this file is qemu image, but seems it’s just temp file because Docker staff(engineer?) recommends if this sparse image size increase to maximum, then just delete it then restart docker application.
Finally, I need another trial to back up data files in volume container.
@riverful You are not required to take a backup of the full qemu image, if that is not your requirement. I suspect some people will be interested in backing-up specific volumes or specific files and directories inside a volume. For these people, a full qemu-file backup is too much, they need more granularity and control over what will be backed-up.
On the topic:
My understanding is that, at the moment, it is a matter of getting onto the Docker host and backing up the folders. Make sense and it is simple enough.
For instance, the local docker volume ls command and the ls command on the Docker host should give you the same result (afaik):
$ docker volume ls
DRIVER VOLUME NAME
$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
$ ls -ltrh /var/lib/docker/volumes
drwxr-xr-x 3 root root 4096 May 16 13:20 04576d248c19b1210d47e94c8211493428cd3c3aa71dfe3fa0f4214589a6f875
drwxr-xr-x 3 root root 4096 May 16 13:20 31af0f01492d8f7b832dad75e731b754302e84fbecfa7c654d7de10465bec204
drwxr-xr-x 3 root root 4096 May 16 13:20 8c511e67b2859e33493798eacf5db901ca40f6dd43725c5472c0c931fb408442
So on the Docker host, I can imagine a backup agent running (or a backup agent connecting to that host) and taking a standard file-based backup of the volumes you’d like to back-up.
aleveille’s explanation is very clear to understand what I’m face with. It makes sense the hash number from volume ls exists as actual file name of /var/lib/docker/volumes in docker itself. I think it’s safe to say both are identical and I can imagine how to make the strategy for backup. Thanks.
Regarding the example of @gesellix, it’s enough for me to utilize it right now. Based on this, I can make the useful scripts for my enviroment. Thanks, too.
And, today I saw the news about newly updated docker beta. Let’s have fun.
hey thanks @riverful for ask, and thanks @aleveille for your replies. At ubuntu I just used to find /var/lib/docker but trying to locate the volumes using Docker beta for Mac is resulting kind of difficult to understand all about that Docker VM
OS: macOS High Sierra Version 10.13.2
Docker version: 17.09.1-ce, build 19e2cf6
I was following an example in a book to learn about how volumes work and came across this as well. On my version of docker, it is running from~/Library/Containers/com.docker.docker and you can run screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty to get into the shell. Then you can run ls /var/lib/docker/volumes