Location of docker images downloaded by Docker (1.9.1) on Mac OS X

MacosDocker

Macos Problem Overview


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: https://stackoverflow.com/questions/19234831/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 Solutions


Solution 1 - Macos

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

Solution 2 - Macos

The Disk image location can also be seen (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

Solution 3 - Macos

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: https://stackoverflow.com/questions/19234831/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.

Solution 4 - Macos

The docker images are stored in a different location on the Mac with Docker Desktop, different to where they are stored on other Linux systems.

Extract from Docker documentation (retrieved 25 March 2020 from https://docs.docker.com/docker-for-mac/space/ )

> Docker Desktop stores Linux containers and images in a single, large > “disk image” file in the Mac filesystem. This is different from Docker > on Linux, which usually stores containers and images in the > /var/lib/docker directory.

On my Mac with MacOS 10.14.6 Mojave, running Docker version 19.03.8 that single large file can be found at:

~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

Solution 5 - Macos

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

Solution 6 - Macos

In my case, I want to locate the docker images and copy them to another location.

Use docker save to Save one or more images to a tar archive (streamed to STDOUT by default)

Link: https://docs.docker.com/engine/reference/commandline/save/

Solution 7 - Macos

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

Solution 8 - Macos

On my Mac with MacOS 10.15.4 Catalina, running Docker 19.03.8 / Docker Desktop 2.3.0.2(45183) the Docker.raw is located here:

~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw 

Solution 9 - Macos

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

Solution 10 - Macos

In Docker Desktop version 2.2.0.4, check out the screenshot below.

enter image description here

Solution 11 - Macos

There's some information on this here. You can check the location by running

docker info| grep "Docker Root Dir"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmbbceView Question on Stackoverflow
Solution 1 - MacosMike ParkView Answer on Stackoverflow
Solution 2 - MacosPierzView Answer on Stackoverflow
Solution 3 - MacosmbbceView Answer on Stackoverflow
Solution 4 - MacosCyclingDaveView Answer on Stackoverflow
Solution 5 - MacosMaged MakledView Answer on Stackoverflow
Solution 6 - MacoszheView Answer on Stackoverflow
Solution 7 - MacosDimiDakView Answer on Stackoverflow
Solution 8 - MacosSylvainView Answer on Stackoverflow
Solution 9 - Macosuser1842947View Answer on Stackoverflow
Solution 10 - Macosf01View Answer on Stackoverflow
Solution 11 - Macosnw79View Answer on Stackoverflow