如何更新Docker映像 [英] How to update a Docker Image

查看:385
本文介绍了如何更新Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在更新官方存储库时如何更新docker映像?

How do I update a docker image when the official repository is updated?

当我更改DockerFile或Dockerfile包含时间敏感时如何更新自定义映像信息?

How do I update custom images when I change the DockerFile, or the Dockerfile contains time sensitive informations?

是建立新图像还是重建现有图像的更好方法?

Is it better practice to build new images, or to rebuild exiting ones?

什么是最好的?重建现有图像的方法?

What's the best way to rebuild an existing image?

区分同一图像的多个构建的最佳方法是什么?

What's the best way to differentiate multiple builds of the same image?

推荐答案


如何在更新官方存储库时更新Docker映像?

How do I update a docker image when the official repository is updated?

如果使用Docker Hub创建自动构建,则可以添加存储库链接,它将在链接的存储库更新时重建存储库。

If you are using the Docker Hub to create an automated build, then you can add a Repository Link which will rebuild your repo when the linked repo updates.

如果您想自己进行构建,则可以创建一个hacky解决方法,以通过锂获取通知如上nk所示,并重建一个琐碎的存储库,然后使用 Web挂钩进行通知您的更改的构建系统。

If you want to do the builds yourself, you could create a hacky workaround to get the notification via a link as above and rebuild a trivial repo, then use a Web Hook to notify your build system of the change.


当我更改DockerFile或Dockerfile包含对时间敏感的信息时,如何更新自定义映像? / p>

How do I update custom images when I change the DockerFile, or the Dockerfile contains time sensitive informations?

如果您使用Docker Hub进行自动构建,则将触发对BitBucket或GitHub源存储库的更改(包括Dockerfile更改)

If you are using the Docker Hub for an automated build, then changes to your BitBucket or GitHub source repo, including Dockerfile changes, will trigger a new build.

如果您自己构建映像,只需在Dockerfile所在的目录中键入 docker build。。您可以使用-no-cache 强制进行全新的重建

If you're building images yourself, just type docker build . in the directory where your Dockerfile resides. You can use --no-cache to force a completely fresh rebuild


是更好的做法是构建新图像,还是重建现有图像?

Is it better practice to build new images, or to rebuild exiting ones?

这取决于谁在使用您的图像。当您构建时,结果始终是一个新图像,但是您如何标记却使结果看起来像是

That depends on who is using your images. When you build, the result is always a new image, but how you tag the result can make it seem like a replacement for the old image or something new.


区分同一图像的多个版本的最佳方法是什么?

What's the best way to differentiate multiple builds of the same image?

在名称中使用:tag 功能,例如

Use the :tag feature in the name, eg

ubuntu:latest
ubuntu:12.04
ubuntu:14.04
...

请参见 https:// Registry.hub.docker.com/_/ubuntu/ 以获得 ubuntu映像上所有变体的完整列表。请参见 tag 有关友好图片名称的完整格式的文档。所有标签和名称都是规范映像名称的别名,即运行 docker images --no-trunc 时长的UUID字符串。

see https://registry.hub.docker.com/_/ubuntu/ for a complete list of all the variations on the "ubuntu" image. See the tag documentation for the complete format for a friendly image name. All tags and names are aliases for the canonical image name, that long UUID-looking string when you run docker images --no-trunc.

这篇关于如何更新Docker映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆