Docker和Dockerhub力量以获取最新图像,但保留卷

发布于 2025-01-25 12:54:59 字数 300 浏览 4 评论 0原文

我有一个脚本可以启动从Dockerhub撤出的Docker图像,

我在相应标签(服务器和工作人员)

链接。

下按照docker compose

update.sh脚本将删除当前图像但保留卷并从dockerhub获取最新图像?

我总是敦促

scanmycode/scanmycode3-ce:server
scanmycode/scanmycode3-ce:worker

这是错误的方式吗?如何实现?

欢迎改善工作流/设置的任何技巧。

I have a script to start Docker images pulled from DockerHub

I push the images under respective tags (server and worker)

Here is link to docker compose

https://github.com/marcinguy/scanmycode-ce/blob/master/dockerhub/docker-compose.yml

How do I make update.sh script that will delete current images but preserve volumes and get latest one from DockerHub?

I always push to

scanmycode/scanmycode3-ce:server
scanmycode/scanmycode3-ce:worker

Is it wrong way to so it? How to achieve it?

Any tips for improving my workflow/setup is welcome.

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

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

发布评论

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

评论(1

假装爱人 2025-02-01 12:54:59

Docker卷具有您可以使用的其他参数,使Docker-Compose忽略了卷的创建/删除。基于官方文档> - 在卷下 - 看音量配置参考 - 外部。

因此,您可以手动创建Docker卷 create 命令和命令和命令和命令和然后调整您的Docker-Compose.yml以参考这些量。在这种情况下,每当您呼叫上/向下拨打时,它都不会创建/调整/删除量。

Docker volumes have additional parameters you can use which makes docker-compose ignore the volume creation/deletion. Based on official documentation - Look under Volumes - Volume configuration reference - external.

So you can then manually create the volumes needed with docker volume create command and then adjust your docker-compose.yml to reference to these volumes. In that case, whenever u call compose up/down it won't create/adjust/remove your volumes.

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