Where are Docker images stored on the host machine?

后端 未结 29 1627
逝去的感伤
逝去的感伤 2020-11-22 06:28

I managed to find the containers under directory /var/lib/docker/containers, but I can\'t find the images.

What are the directories and files under

相关标签:
29条回答
  • 2020-11-22 07:04

    Actually, Docker images are stored in two files as shown by following command

    $ docker info
    

    Data file: /var/lib/docker/devicemapper/devicemapper/data

    Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata

    0 讨论(0)
  • 2020-11-22 07: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 the /Users/<username>/.docker/machine/machines/default/ directory.

    0 讨论(0)
  • 2020-11-22 07:05

    On Fedora, Docker uses LVM for storage if available. On my system docker info shows:

    Storage Driver: devicemapper
     Pool Name: vg01-docker--pool
     Pool Blocksize: 524.3 kB
     Base Device Size: 10.74 GB
     Backing Filesystem: xfs
     Data file:
     Metadata file:
     Data Space Used: 9.622 GB
     ...
    

    In that case, to increase storage, you will have to use LVM command line tools or compatible partition managers like blivet.

    0 讨论(0)
  • 2020-11-22 07:07

    The images are stored in /var/lib/docker/graph/<id>/layer.

    Note that images are just diffs from the parent image. The parent ID is stored with the image's metadata /var/lib/docker/graph/<id>/json.

    When you docker run an image. AUFS will 'merge' all layers into one usable file system.

    0 讨论(0)
  • 2020-11-22 07:07
    sudo docker info | grep -e "Root Dir"
    
    0 讨论(0)
  • 2020-11-22 07:07

    check for the docker folder in /var/lib

    the images are stored at below location:

    /var/lib/docker/image/overlay2/imagedb/content
    
    0 讨论(0)
提交回复
热议问题