docker-compose继续使用旧的图像内容 [英] docker-compose keeps using old image content

查看:80
本文介绍了docker-compose继续使用旧的图像内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用gitlab-ci使用最新版本的代码来构建新图像。
这些图像是每天使用最新标签构建的。
我们在发布过程中标记图像。

We use our gitlab-ci to build fresh images with the latest version of our code. These images are day to day built with the latest tag. We tag images during the release process.

我的问题与最新标签有关。
我们会在服务器上自动部署这些映像以测试我们的产品。

My problem is related to the latest tag. We deploy automatically these images on servers to test our product.

但是,在测试服务器上,如果我们提取最新的docker映像(通过其校验和验证) ,停止撰写并再次进行整理,有时我们仍然拥有旧映像的内容(例如配置文件)。

However, on a test server if we pull the latest docker image (verified by its checksum), stop the compose and up it again, we sometime still have the content of the old image (for example a configuration file).

我们尝试了 docker-compose up -d --force-recreate ,但没有帮助。

We tried with docker-compose up -d --force-recreate but it doesn't help.

唯一的解决方法是:

docker-compose down
docker system prune -f
docker rmi $(docker images -q)
docker-compose pull
docker-compose up -d

有更好的主意吗?

推荐答案

根据文档,您可以使用以下命令忽略上一卷中的数据:

According to the documentation, you can ignore data from previous volume with this:

docker-组成-d --force-recreate --renew-anon-volumes

请参见 https://docs.docker.com/撰写/引用/向上/

这篇关于docker-compose继续使用旧的图像内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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