Location of docker images downloaded by Docker (1.

2019-01-13 05:40发布

Where are the docker images located once they are downloaded from docker hub in Mac OSX. For example if I run a command like:

docker run hello-world

the image is downloaded and the container is run but where is that image located on my system?

Note: Where are Docker images stored on the host machine? This question has answers related to linux machine, mainly. The answers for Mac OS X are considering that boot2docker is being used alongside docker installation, which is not the case for me.

标签: macos docker
6条回答
可以哭但决不认输i
2楼-- · 2019-01-13 05:45

The location of the disk image can also be obtained (as mentioned in the docs) by selecting Preferences->Advanced menu from the Docker toolbar icon (works in Docker-CE v17):

Docker->Preferences->Advanced

Update: As mentioned by @udondan Docker now has a separate 'Disk' tab in Preferences where it shows the disk image location:

Docker->Preferences->Disk

查看更多
smile是对你的礼貌
3楼-- · 2019-01-13 05:45

This answer doesn't concern the "boot2Docker" version for MAC. Here I have the Version 17.12.0-ce-mac55, you have to keep in mind that Docker is still running in a VM, the system paths are relative to the VM and not from the Mac Osx system. As it says all is contained in a VM file :

/Users/MyUserName/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

Try to run Alpine image with this volume option and the ls command you are able to list the VM host:

docker run --rm -it -v /:/vm-root alpine:edge ls -l /vm-root

After this just try :

docker run --rm -it -v /:/vm-root alpine:edge ls -l /vm-root/var/lib/docker

Now, you are able to list the docker folder from the WM host

查看更多
一夜七次
4楼-- · 2019-01-13 05:47

For someone who is using Docker toolbox (that uses docker-machine), the answers concerning boot2docker on Mac OS X is not valid. The docker-machine VM is called "default" and it exists in /Users/<username>/.docker/machine/machines/default/ directory.

Note: I have also added this answer to this question: Where are Docker images stored on the host machine? but I am answering here as well so that it's easier to find the answer for someone specifically looking for Mac OS X and new version of Docker.

查看更多
\"骚年 ilove
5楼-- · 2019-01-13 05:48

And if you are using Docker for Mac then the location is again different, namely:

/Users/MyUserName/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
查看更多
你好瞎i
6楼-- · 2019-01-13 05:56

In my case (Mavericks / docker brew installed / Image name: default) is located under

/Users/<Username>/.docker/machine/machines/.

(You gotta use terminal and not finder to see it. )

   ls -lah /Users/Mitsos/.docker/machine/machines/
    total 0
    drwx------   3 Mitsos  staff   102B Dec  8 19:03 .
    drwxr-xr-x   5 Mitsos  staff   170B Sep 22 13:52 ..
    drwx------  13 Mitsos  staff   442B Dec  8 19:04 default
查看更多
何必那么认真
7楼-- · 2019-01-13 05:58

To elaborate on how to open these folders in case you are getting now directory because it is a mounted on virtual host not your Mac regular volume

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty 

ls -ltrh /var/lib/docker/volumes

Answer from here

If you want to control the volume from your mac, you can map it while you are creating the container

docker run -it --name voltest2 -v /path/to_mac/directory/MyHostDir:/mydata centos:latest /bin/bash

which will map a directory mydata on your container to a directory /path/to_mac/directory/MyHostDiron your mac

查看更多
登录 后发表回答