54

我目前在做什么:

Dockerfile:

FROM python:3.5.1

ENV PYTHONUNBUFFERED 1

RUN mkdir /www
WORKDIR /www
ADD deps.txt /www/
RUN pip3 install -r deps.txt
ADD . /www/
RUN chmod 0755 /www/docker-init.sh

构建命令:

docker build -t my-djnago-app:latest .

标记:

docker tag my-djnago-app:latest lolorama/my-djnago-app-img:latest

推动:

docker push lolorama/my-djnago-app-img:latest

执行这些步骤后,存储库映像仍未更新。我不断收到此消息 - “图层已存在”。

The push refers to a repository [docker.io/lolorama/my-django-app-img]
fd5aa641b308: Layer already exists
d9c60c6f98e8: Layer already exists
d9d14867f6d7: Layer already exists
64ce166099ca: Layer already exists
73b670e35c69: Layer already exists
5f70bf18a086: Layer already exists
9ea142d097a5: Layer already exists
52f5845b1de0: Layer already exists
e7fadb3ab9d4: Layer already exists
cef72744de05: Layer already exists
591569fa6c34: Layer already exists
998608e2fcd4: Layer already exists
c12ecfd4861d: Layer already exists

我究竟做错了什么?

4

3 回答 3

37

感谢@lorenzvth7,我找到了问题!

我有两张具有相同标签的图像(我正在推送到云端)。

解决方案是:

  1. 检查您的图像并找到两个或更多具有相同标签的图像:

    docker images 
    
  2. 删除它们:

    docker rmi --force 'image id'
    
  3. 而已!按照我上面的问题的步骤。
于 2016-04-20T07:58:52.037 回答
13

另一个解决方案,尽管是蛮力,是在再次推送之前使用--no-cache标志重建。

docker rmi --force my-djnago-app:latest

docker build -t my-djnago-app:latest . --no-cache

docker push my-djnago-app:latest
于 2019-08-21T19:21:22.343 回答
1

我也遇到了这个问题(In my web application),像这样:

# when I push my contaimer to repo
$ docker push <container>
The push refers to repository [docker.io/xx/getting-started]
fd5aa641b308: Layer already exists
d9c60c6f98e8: Layer already exists
d9d14867f6d7: Layer already exists
64ce166099ca: Layer already exists
73b670e35c69: Layer already exists
5f70bf18a086: Layer already exists
9ea142d097a5: Layer already exists
52f5845b1de0: Layer already exists

我尝试了我的解决方案,它的工作原理!

# force remove image
$ docker rmi --force <image-id>
# tag for image
$ docker tag <image-name> <your-dockerHub-username>/<image-name>
# push image, just done!
$ docker push <your-user-name>/<image-name>

终端输出:

# when I push my container to repo
$ docker push <container>
The push refers to repository [docker.io/xx/getting-started]
# it'll push your part of changes
fd5aa641b308: Pushed
d9c60c6f98e8: Pushed
d9d14867f6d7: Layer already exists
64ce166099ca: Layer already exists
73b670e35c69: Layer already exists
5f70bf18a086: Layer already exists
9ea142d097a5: Layer already exists
52f5845b1de0: Layer already exists

然后,打开my web appliction,它更新了最新版本!

于 2021-01-29T08:39:14.027 回答