Docker Community Forums

Share and learn in the Docker community.

Where are images stored on Mac OS X?


(Apptite) #1

I just installed Docker for Mac and Kinematic. It works fine and I can pull an image (with the command line or the Kinematic UI) and run a container (again with the command and the UI).

But I can’t seem to find the physical location of the images on the host Mac OS X, where should they be? Cleaning up with docker rm and docker rmi also works, but I would like to browse the folder :wink:


(Badonk) #2

It depends on the driver being used, but the default is: $HOME/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2


(Javier Rivera) #3

I’m on mac OS X 10.12.3 using kitematic 0.13.1.

My VM images are stored here: /Users/USERNAME/.docker/machine/machines
See: http://stackoverflow.com/questions/32605383/location-of-docker-images-downloaded-by-docker-1-9-1-on-mac-os-x

You should see a “default” folder here that is your base VM. If you’ve created others, they’d be here as well.

This is different than the docker containers you create or download.

Those are stored at …


(Vipintech2k4) #4

Hi

I am running docker on Mac High Sierra ( version 10.13.3) . docker inspect on my container shows path is /var/lib/docker .But there is no such folder created. Could some one help with image location on Mac pls. And also why docker inspect shows different path? Am i missing something here ? Logs below

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0545bfe74ae2 centos “/bin/bash” 7 minutes ago Up 7 minutes stoic_curran
Vipins-MacBook-Air:Library root# docker inspect 0545bfe74ae2
[
{
“Id”: “0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44”,
“Created”: “2018-06-13T03:43:34.009542284Z”,
“Path”: “/bin/bash”,
“Args”: [],
“State”: {
“Status”: “running”,
“Running”: true,
“Paused”: false,
“Restarting”: false,
“OOMKilled”: false,
“Dead”: false,
“Pid”: 1701,
“ExitCode”: 0,
“Error”: “”,
“StartedAt”: “2018-06-13T03:43:34.621987883Z”,
“FinishedAt”: “0001-01-01T00:00:00Z”
},
“Image”: “sha256:49f7960eb7e4cb46f1a02c1f8174c6fac07ebf1eb6d8deffbcb5c695f1c9edd5”,
“ResolvConfPath”: “/var/lib/docker/containers/0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44/resolv.conf”,
“HostnamePath”: “/var/lib/docker/containers/0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44/hostname”,
“HostsPath”: “/var/lib/docker/containers/0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44/hosts”,
“LogPath”: “/var/lib/docker/containers/0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44/0545bfe74ae25e9e2c034b816f4926d1aac5ba6d496e20f8131fcb43f96c5d44-json.log”,
“Name”: “/stoic_curran”,
“RestartCount”: 0,
“Driver”: “overlay2”,
“Platform”: “linux”,
“MountLabel”: “”,
“ProcessLabel”: “”,
“AppArmorProfile”: “”,
“ExecIDs”: null,
“HostConfig”: {
“Binds”: null,
“ContainerIDFile”: “”,
“LogConfig”: {
“Type”: “json-file”,
“Config”: {}
},
“NetworkMode”: “default”,
“PortBindings”: {},
“RestartPolicy”: {
“Name”: “no”,
“MaximumRetryCount”: 0
},
“AutoRemove”: false,
“VolumeDriver”: “”,
“VolumesFrom”: null,
“CapAdd”: null,
“CapDrop”: null,
“Dns”: [],
“DnsOptions”: [],
“DnsSearch”: [],
“ExtraHosts”: null,
“GroupAdd”: null,
“IpcMode”: “shareable”,
“Cgroup”: “”,
“Links”: null,
“OomScoreAdj”: 0,
“PidMode”: “”,
“Privileged”: false,
“PublishAllPorts”: false,
“ReadonlyRootfs”: false,
“SecurityOpt”: null,
“UTSMode”: “”,
“UsernsMode”: “”,
“ShmSize”: 67108864,
“Runtime”: “runc”,
“ConsoleSize”: [
0,
0
],
“Isolation”: “”,
“CpuShares”: 0,
“Memory”: 0,
“NanoCpus”: 0,
“CgroupParent”: “”,
“BlkioWeight”: 0,
“BlkioWeightDevice”: [],
“BlkioDeviceReadBps”: null,
“BlkioDeviceWriteBps”: null,
“BlkioDeviceReadIOps”: null,
“BlkioDeviceWriteIOps”: null,
“CpuPeriod”: 0,
“CpuQuota”: 0,
“CpuRealtimePeriod”: 0,
“CpuRealtimeRuntime”: 0,
“CpusetCpus”: “”,
“CpusetMems”: “”,
“Devices”: [],
“DeviceCgroupRules”: null,
“DiskQuota”: 0,
“KernelMemory”: 0,
“MemoryReservation”: 0,
“MemorySwap”: 0,
“MemorySwappiness”: null,
“OomKillDisable”: false,
“PidsLimit”: 0,
“Ulimits”: null,
“CpuCount”: 0,
“CpuPercent”: 0,
“IOMaximumIOps”: 0,
“IOMaximumBandwidth”: 0
},
“GraphDriver”: {
“Data”: {
“LowerDir”: “/var/lib/docker/overlay2/1a95cc49d89829285e77ed99a67f42c64466c421a01c11b2b085aedb59220371-init/diff:/var/lib/docker/overlay2/15b85ac67b96997c979612b11803fad7be9ae06b8ffc6e77e1c03d58fe5dcea5/diff”,
“MergedDir”: “/var/lib/docker/overlay2/1a95cc49d89829285e77ed99a67f42c64466c421a01c11b2b085aedb59220371/merged”,
“UpperDir”: “/var/lib/docker/overlay2/1a95cc49d89829285e77ed99a67f42c64466c421a01c11b2b085aedb59220371/diff”,
“WorkDir”: “/var/lib/docker/overlay2/1a95cc49d89829285e77ed99a67f42c64466c421a01c11b2b085aedb59220371/work”
},
“Name”: “overlay2”
},
“Mounts”: [],
“Config”: {
“Hostname”: “0545bfe74ae2”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: true,
“AttachStdout”: true,
“AttachStderr”: true,
“Tty”: true,
“OpenStdin”: true,
“StdinOnce”: true,
“Env”: [
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
],
“Cmd”: [
“/bin/bash”
],
“Image”: “centos”,
“Volumes”: null,
“WorkingDir”: “”,
“Entrypoint”: null,
“OnBuild”: null,
“Labels”: {
“org.label-schema.schema-version”: “= 1.0 org.label-schema.name=CentOS Base Image org.label-schema.vendor=CentOS org.label-schema.license=GPLv2 org.label-schema.build-date=20180531”
}
},
“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “d821d222acd141bc07c13333386f5da81b2beb339cf685ed6668ee3fdb210f40”,
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“Ports”: {},
“SandboxKey”: “/var/run/docker/netns/d821d222acd1”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “cc1fcf8cd30e856d1a89a77550207f114e342db219904c13ed4eca4cda6a0d5b”,
“Gateway”: “172.17.0.1”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “172.17.0.2”,
“IPPrefixLen”: 16,
“IPv6Gateway”: “”,
“MacAddress”: “02:42:ac:11:00:02”,
“Networks”: {
“bridge”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: null,
“NetworkID”: “9d02913f2d7eaf950523473524322bf896e6e522c29360f50c1287b38b4e4bbb”,
“EndpointID”: “cc1fcf8cd30e856d1a89a77550207f114e342db219904c13ed4eca4cda6a0d5b”,
“Gateway”: “172.17.0.1”,
“IPAddress”: “172.17.0.2”,
“IPPrefixLen”: 16,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “02:42:ac:11:00:02”,
“DriverOpts”: null
}
}
}
}
]

ls -ld /var/lib/docker/containers/

ls: /var/lib/docker/containers/: No such file or directory


(John Rofrano) #5

You are missing the subtlety from the previous replies that Docker does not run natively a Mac because the macOS kernel isn’t compatible (i.e., BSD vs Linux). Docker is actually running in a virtual machine using HyperKit. The Docker vm disc image defaults to being in either:

$HOME/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

or

$HOME/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.raw

Depending on if you chose the raw filesystem or not. So the folder location of /var/lib/docker is inside of this virtual machine and not on your macOS filesystem which is why you can’t find it with ls.

You can use:

docker volume ls

to list the volumes in this folder, and use:

docker volume prune

command to remove unused container volumes.

BTW, this disk image never gets smaller. So as you added images to Docker and then remove them, removing them doesn’t take up any less space although when you add the next image it will reuse that space but once allocated it never shrinks.

~jr