CBBSpike
CBBSpike

Reputation: 1460

Docker for Windows "Already exists" image does not exist at all

I am trying to pull an image that should also be pulling the aspnet:4.7 image. However docker keeps telling me the image "Already exists", but it does not. Is there a way to tell Docker for Windows to pull the required images anyways?

PS C:\WINDOWS\system32> docker pull -a [hidden]/mycode
dev: Pulling from [hidden]/mycode
3889bb8d808b: Already exists
e29afd68a947: Already exists
36f010181129: Already exists
94c1c860b007: Already exists
d8096eabbf13: Already exists
67025ded22a8: Already exists
dbe75d79f130: Already exists
84d3d4630614: Already exists
301ba58699fa: Already exists
5e9f3c14f629: Already exists
90fd39402ca5: Already exists
4791db5edc55: Pull complete
1da86da74a58: Pull complete
3acc18896b8f: Pull complete
Digest: sha256:dc7e28154e63d5c22a210c314b4a80dcdba7baeea0ebf853445853680276293d
prod: Pulling from [hidden]/mycode
3889bb8d808b: Already exists
e29afd68a947: Already exists
36f010181129: Already exists
94c1c860b007: Already exists
d8096eabbf13: Already exists
67025ded22a8: Already exists
dbe75d79f130: Already exists
84d3d4630614: Already exists
301ba58699fa: Already exists
5e9f3c14f629: Already exists
a1fa39b61ce3: Already exists
98fa6868a880: Pull complete
10db2dd5f47b: Pull complete
5c881ba7245b: Pull complete
Digest: sha256:8b0464fe849148f4fb3c8e165cc7539823d974171bdb596bed48dd91bd9da20d
Status: Downloaded newer image for brunofvalli/xehub
PS C:\WINDOWS\system32> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[hidden]/mycode  dev                 6e8a0b8dd5f9        24 hours ago        11.8GB
[hidden]/mycode   prod                98a5df79a3ce        24 hours ago        11.8GB
PS C:\WINDOWS\system32>

I have tried to do a

docker rmi 3889bb8d808b

But it tell me the image does not exist.

How do I delete these cached images? Or how do I force Docker to download the image anyways?

EDIT I guess I should have started with the problem. The microsoft/aspnet:4.7 layer/image is about 4GB is size. Currently when I try to build my application using this layer/image it is failing, my guess is that it got corrupted, since doing in another machine works fine. I want to re-fetch this base image, but doing docker rmi is not removing this "cached" image/layer from my system, so I get this Already exists message. I want to re-download the 4GB image again. Is there a way to do this? I am getting really close on just reinstall Windows 10.

Upvotes: 4

Views: 3314

Answers (4)

Samuel Thompson
Samuel Thompson

Reputation: 2574

docker has a solution for this on docker dashboard, just press the button below and presto it works! enter image description here

Upvotes: -1

CBBSpike
CBBSpike

Reputation: 1460

Could not make this work. Decided to Reinstall Windows :( Hopefully this error will not show up again.

Upvotes: 0

Ayushya
Ayushya

Reputation: 10447

There is no need to remove that cache, docker is already downloading newer images. Image is built in parts and those parts are called layers.

When an image is changed, there are changes to some of the layers mostly. So it's OK if docker says that image already exists. What docker actually means is, that particular layer already exists and has not changed at remote location.


EDIT:

For Linux Users:

If you want to look at where the data of images is stored you can visit /var/lib/docker/image/aufs. There you will find imagedb and layerdb

For Windows users:

/var/lib/docker is mounted on the persistent Virtual Disk of the VM which is under C:\Users\Public\Documents\Hyper-V\Virtual hard disks. For more info, refer here. The discussion there is regarding where images are stored and how to change default location.

Upvotes: 2

t6nand
t6nand

Reputation: 780

I think you are confusing layer with the image. Docker images are built using dockerfile. Every line in dockerfile adds up a layer which makes up your image. For example taking basic dockerfile below and layer identifier from your example above:

FROM busybox:latest # ----> 3889bb8d808b
MAINTAINER person # ----> e29afd68a947
RUN touch foo.txt # ----> 36f010181129
CMD ["bin/sh"] # ------> 94c1c860b007

This would create a single docker image with every line in dockerfile making up a layer in docker image. Thus, the first line would make up a layer of base image busybox:latest with identifier 3889bb8d808b. Subsequently, further layers are added on top of the preceding layer corresponding to dockerfile's line. This really helps especially when we make a change to docker file, the line which is changed would trigger building image much fast as layer corresponding to that line alone would be pulled along.

It's also important to note that if a layer already exists in your machine as a part of some other docker image, it's used directly without pulling the same layer again every time. Thus, in your case the layers saying already exists may be layers pulled earlier in some other image or even the same image where you just updated the dockerfile at later stages thus, triggering layer pulls corresponding to only changed lines.

Thus when you try docker rmi 3889bb8d808b docker correctly says that image does not exist. Since 3889bb8d808b identifier corresponds to a layer and not docker image.

If you want to pull docker image fresh, use docker images to find the image ID corresponding to your Docker image and remove it using docker rmi <image-ID>. Then use docker pull -a brunofvalli/xehub

Upvotes: 5

Related Questions