Where are Docker images stored on the host machine

2018-12-31 18:01发布

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 /var/lib/docker?

19条回答
春风洒进眼中
2楼-- · 2018-12-31 18:54

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

查看更多
只若初见
3楼-- · 2018-12-31 18:56

If you are using Docker for MAC (not boot2docker) then the location is /Users/<</>UserName></>/Library/Containers/com.docker.docker/Data/

查看更多
十年一品温如言
4楼-- · 2018-12-31 18:56

I use the boot2docker for Docker on Mac OSX, so the images is stored into the /Users/<USERNAME>/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vmdk.

查看更多
何处买醉
5楼-- · 2018-12-31 18:58

Expanding on Tristan's answer, in Windows with Hyper-V you can move the image with these steps from matthuisman:

In Windows 10,

  1. Stop docker etc
  2. Type "Hyper-V Manager" in task-bar search box and run it.
  3. Select your PC in the left hand pane (Mine is called DESKTOP-CBP**)
  4. Right click on the correct virtual machine (Mine is called MobyLinuxVM)
  5. Select "Turn off" (If it is running)
  6. Right click on it again and select "Move"
  7. Follow the prompts
查看更多
大哥的爱人
6楼-- · 2018-12-31 19:01

In Docker for Windows (native Windows) the default container storage is at:

   > docker info
   ...
   Docker Root Dir: C:\ProgramData\Docker
   ...
查看更多
临风纵饮
7楼-- · 2018-12-31 19:04

On the newly released 'Docker for Windows', which uses Hyper-V, data is located in the Docker virtual hard disk:

C:\Users\Public\Documents\Hyper-V\Virtual hard disks\MobyLinuxVM.vhdx

You can also open the 'Hyper-V Manager' for access to the Docker / MobyLinuxVM.

查看更多
登录 后发表回答