对将Docker图像推到Dockerhub感到困惑

发布于 2025-02-01 02:50:20 字数 273 浏览 6 评论 0原文

Docker Newbie在这里:我在OSX上使用Docker Desktop建立了本地开发环境。当我想将Docker Image推到Dockerhub时​​,我正在更新Dockerfile时,我需要重新启动我的容器还是不需要?当我更新Dockerfile时,用“最新”标签将其标记,然后将其推到Dockerhub,然后尝试通过无人机将其拉入Kubernetes,似乎一直是旧的Docker映像。至少无人机或Kubernetes没有加载最新版本。我可以在Dockerhub上访问实际的Dockerfile,以仔细检查是否正确推开了?

Docker newbie here: I have my local development environment set up with Docker desktop on OSX. When I want to push my Docker image to Dockerhub and I am updating the Dockerfile do I need to relaunch my container or is that not necessary? When I update the Dockerfile, tag it with the "latest" tag and push it to Dockerhub and then try to pull it into Kubernetes through Drone it seems to constantly be the old Docker image. At least Drone or Kubernetes are not loading the newest version. Can I access the actual Dockerfile on Dockerhub to double check if it has been pushed correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烂柯人 2025-02-08 02:50:20

在标记图像时,最佳实践是为每个新版本设置一个单独的标签(使用语义版本,提交哈希或任何其他适用您的系统),而不是使用最新

使用最新的标签可以产生无法预见的后果,因为豆荚在群集上重新安排了,并且可能导致同时运行的不同版本。

如果您确实坚持使用最新版本,则可以将部署的image> image pullpolicy设置为始终,它将提示K8S尝试拉动该图像的当前版本,即使它已经在计算机上存在。在

When tagging images, the best practice is setting a separate tag for each new version (using semantic versioning, commit hash or any other system that suites you) rather than using the latest.
Using the latest tag can create unforeseen consequences as pods are rescheduled across your cluster and can lead to disparate versions running concurrently.

If you do insist on using the latest version, you can set the imagePullPolicy of your deployment to Always, which will prompt k8s to try and pull the current version of the image, even if it's already present on the machine. See more details in the k8s docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文