Where is docker image location in Windows 10?

前端 未结 13 1603
慢半拍i
慢半拍i 2020-12-08 09:06

I\' using Windows 10 Home operating system. I have installed Docker toolbox.

I have created docker image of my .net core application by using following command.

<
相关标签:
13条回答
  • 2020-12-08 09:48

    mine can be found in "C:\Users\Public\Documents\Hyper-V\Virtual hard disks"

    0 讨论(0)
  • 2020-12-08 09:51

    you can use below command to export your image and can copy same to linux / another machine docker export [OPTIONS] CONTAINER

    example:

    docker export --output="latest.tar" red_panda
    
    0 讨论(0)
  • 2020-12-08 09:53

    If you are on windows 10 and running windows containers

    In the above image, docker is running windows containers. So its showing switch to linux containers.

    First run docker info command (more specific docker info --format “{{json .DockerRootDir}}”).

    You should see root dir as

    Docker Root Dir: C:\ProgramData\Docker

    Now run a command to pull an image like

    docker pull hello-world
    

    After it pulls the image, you can look into the docker root dir.

    Notice the current modified date time. In one of the folders you can see the sha of the layers.

    Finally, you also have to take a look into the following folder, if you want to know where the images are downloaded. The two folders above and below are

    • C:\ProgramData\Docker\image\windowsfilter
    • C:\ProgramData\Docker\windowsfilter

    Now for linux images.

    If your docker is running windows containers, and then if you try to fetch a linux based container such as nginx, like so

    docker pull nginx:latest
    

    you will get a message as follows.

    latest: Pulling from library/nginx
    no matching manifest for windows/amd64 10.0.18363 in the manifest list entries
    

    So switch to linux contaners. See the very first image.

    Once the docker for linux is running, run the command again.

    docker pull nginx:latest
    

    You can see that image is downloading.

    Now where is this image downloaded on your hard disk? docker info command may not help much in this case.

    So start again. Click Settings and not "Switch to Windows Containers..."

    And now see the path.

    On my machine, it's C:\ProgramData\DockerDesktop\vm-data

    Note the date modified column. Notice and observe that after you pull or remove a linux based image.

    That's a diskspace reserved for linux env, so you will not be able to browse further down to see where the image is.

    but if you have to, then launch a linux based VM, install docker and explore the path /var/lib/docker/

    Sometimes you may encounter permission issues. If so see this and this

    0 讨论(0)
  • 2020-12-08 09:54

    The answers are really confusing because there is more than one way to run Docker in Windows. The newest way is with Windows 10 Home May 2020 Update. I will use the new version of Windows Subsystem for Linux (WSL2).

    After activating WSL2, you'll install Docker Desktop. Docker Desktop is a client that'll connect to the host inside the WSL.

    The image directory is somewhat inconsistent. If you run docker info in your host machine or inside WSL it will give you the path Docker Root Dir: /var/lib/docker which doesn't exist:

    $ ls /var/lib/docker
    ls: cannot access '/var/lib/docker': No such file or directory
    

    You'll find the images in

    /mnt/wsl/docker-desktop-data/
    

    Or in this Windows Explorer path:

    \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker\image
    

    If you are using Windows 10 non-Home versions, it may work differently. Take a look at the other answers. Since I don't have access to this OS, I won't try to answer.

    0 讨论(0)
  • 2020-12-08 09:54

    When you have Windows Containers activated, your images are stored by default in C:\ProgramData\Docker\

    To change this, you can edit the C:\ProgramData\Docker\config\daemon.json and add a new "graph" key with the new path... (notice that every backslash is escaped with another backslash)

    Example:

    {
      "registry-mirrors": [],
      "insecure-registries": [],
      "debug": true,
      "experimental": false,
      "graph": "D:\\ProgramData\\Docker"
    }
    

    After that, you need to restart Docker service and you can verify your changes using docker info command and look at Docker Root Dir entry.

    0 讨论(0)
  • 2020-12-08 09:56

    To to ship this image, to another machine :

    docker ps -a  
    #or docker container ls -a
    docker commit <container-id> mynewimage
    #start here if you never started your image 
    #(ex: if just created using docker build -t helloWorld:core .)
    docker image ls
    docker save mynewimage > /tmp/mynewimage.tar
    

    On the other machine:

    docker load < /tmp/mynewimage.tar
    docker images
    

    As explained in comments above, when working on windows with linux containers, containers resides within the docker disk image located at DockerDesktop/settings/advanced/DiskImageLocation

    see here

    0 讨论(0)
提交回复
热议问题