Docker - 重建映像并将更新后的映像推送到 docker 云的正确方法是什么?
Docker - What is proper way to rebuild and push updated image to docker cloud?
我目前在做什么:
Docker 文件:
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
完成这些步骤后,存储库映像仍未更新。我不断收到此消息 - "Layer already exists".
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
我做错了什么?
我找到了问题,感谢@lorenzvth7!
我有两张带有相同标签的图片(我正在将其推送到云端)。
解决方案是:
检查您的图像并找到两个或更多具有相同标签的图像:
docker images
删除它们:
docker rmi --force 'image id'
- 就是这样!按照我上面的问题中的步骤进行操作。
另一种解决方案,尽管是蛮力,是在再次推送之前使用 --no-cache 标志进行重建。
docker rmi --force my-djnago-app:latest
docker build -t my-djnago-app:latest . --no-cache
docker push my-djnago-app:latest
我也遇到了这个问题(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
,更新到最新版本了!
我目前在做什么:
Docker 文件:
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
完成这些步骤后,存储库映像仍未更新。我不断收到此消息 - "Layer already exists".
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
我做错了什么?
我找到了问题,感谢@lorenzvth7!
我有两张带有相同标签的图片(我正在将其推送到云端)。
解决方案是:
检查您的图像并找到两个或更多具有相同标签的图像:
docker images
删除它们:
docker rmi --force 'image id'
- 就是这样!按照我上面的问题中的步骤进行操作。
另一种解决方案,尽管是蛮力,是在再次推送之前使用 --no-cache 标志进行重建。
docker rmi --force my-djnago-app:latest
docker build -t my-djnago-app:latest . --no-cache
docker push my-djnago-app:latest
我也遇到了这个问题(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
,更新到最新版本了!