且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Docker 镜像存储在主机上的什么位置?

更新时间:2023-11-22 18:37:34

/var/lib/docker 目录的内容因 Docker 用于存储的驱动程序.

默认情况下这将是 aufs 但可以回退到 overlayoverlay2btrfsdevicemapperzfs 取决于您的内核支持.在大多数地方,这将是 aufsRedHat 使用 devicemapper.

By default this will be aufs but can fall back to overlay, overlay2, btrfs, devicemapper or zfs depending on your kernel support. In most places this will be aufs but the RedHats went with devicemapper.

您可以使用 -s--storage-driver= 选项到 Docker 守护进程.

  • /var/lib/docker/{driver-name} 将包含图像内容的驱动程序特定存储.
  • /var/lib/docker/graph/ 现在只包含关于图像的元数据,在 jsonlayersize文件.
  • /var/lib/docker/{driver-name} will contain the driver specific storage for contents of the images.
  • /var/lib/docker/graph/<id> now only contains metadata about the image, in the json and layersize files.

对于aufs:

  • /var/lib/docker/aufs/diff/ 包含图像的文件内容.
  • /var/lib/docker/repositories-aufs 是一个包含本地图像信息的 JSON 文件.这可以使用命令 docker images 来查看.
  • /var/lib/docker/aufs/diff/<id> has the file contents of the images.
  • /var/lib/docker/repositories-aufs is a JSON file containing local image information. This can be viewed with the command docker images.

对于devicemapper:

  • /var/lib/docker/devicemapper/devicemapper/data 存储图像
  • /var/lib/docker/devicemapper/devicemapper/metadata 元数据
  • 请注意,这些文件是精简配置的稀疏"文件,因此并没有看起来那么大.