StacksJar
Made with π by Arif Shaikh with all Passion.
Docker mkdir permission Failed ? For using data volumes in Docker by command-line and If your Docker host is on the Linux platform, you can find Docker volumes by /var/lib/docker/volumes path.
Although, it's not the same while using Docker for Mac. Try to cd /var/lib/docker/volumes
from your MacOS terminal, you will get zilch. This is because the Mac machine is not a real Docker host. Docker for Mac runs a virtual machine under the hood and makes things a bit complex.
To access persistent volumes in Docker for MacOS. First, we have to log in to the hidden virtual machine, which is also kind of difficult.
To accomplish this, we have to utilize the serial terminal on Mac. Screen is the name of the application which is available in the market and we are going to use that in our case.
We need to "screen into" the Docker driver by executing the below command:
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
It will result in a blank screen, just press Enter, and in some time, it will show a command-line prompt:
docker-desktop:~#
Now we are into the Docker's hidden Virtual Machine and we can cd into the volumes directory by typing the below command
cd /var/lib/docker/volumes