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
<
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/
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
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
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
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):
Update: As mentioned by @udondan Docker now has a separate 'Disk' tab in Preferences where it shows the disk image location:
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