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

后端 未结 11 1143
有刺的猬
有刺的猬 2020-12-07 18:15

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
<         


        
相关标签:
11条回答
  • 2020-12-07 19:05

    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.

    0 讨论(0)
  • 2020-12-07 19:11

    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

    0 讨论(0)
  • 2020-12-07 19:12

    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
    
    0 讨论(0)
  • 2020-12-07 19:13

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

    0 讨论(0)
  • 2020-12-07 19:13

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

    docker info| grep "Docker Root Dir"
    
    0 讨论(0)
提交回复
热议问题