![Tty Tty](/uploads/1/2/6/2/126274297/710763813.png)
If you use persistent data volumes in Docker, you might want to access themvia command-line. If your docker host is Linux, that's not a problem; you canfind Docker volumes by /var/lib/docker/volumes path.
However, that's not the case when you use Docker for Mac. Try to
cd/var/lib/docker/volumes
from your MacOS terminal, and you 'll get nothing.You see, your Mac machine isn't a real Docker host. Docker for Mac runs avirtual machine behind the scenes and hides it from you to make thingssimpler. Simpler, unless you want to dig deeper.So, to access persistent volumes created by Docker for Mac, you need to log inthat hidden virtual machine first, which is not that straightforward.
In order to accomplish this, we need to use a serial terminal on Mac. There'sa terminal application called 'screen' that's going to help us.
May 8, 2017 - Docker for Mac instead uses virtualization technology that is already part..docker.docker/Data/com.docker.driver.amd64-linux/tty – and boom. MacOS with Docker for Mac. You have to explicitly accept them either by attaching a tty when you run the Docker image and accepting yes at the prompts.
- We need to 'screen into' the Docker driver by executing a command:
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
- You should see a blank screen, just press Enter , and after a while, you should see a command line prompt
- Now you're inside Docker's VM and you can cd into volumes dir by typing:
cd /var/lib/docker/volumes
- Profit, you got there!
- If you need to transfer files from your MacOS host into Docker host (for example to put files into docker volumes) use directories shared between host (mac os) and Docker host (Docker VM), you can find a list of such directories under File Sharing tab of your Docker for Mac application.
![Docker For Mac Tty Docker For Mac Tty](/uploads/1/2/6/2/126274297/508420536.png)
Hope this helps someone!