docker-compose 继续使用旧的图像内容 [英] docker-compose keeps using old image content
问题描述
我们使用 gitlab-ci 使用最新版本的代码构建新图像.这些图像每天都使用 latest
标签构建.我们在发布过程中标记图像.
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.
我的问题与 latest
标签有关.我们会在服务器上自动部署这些图像以测试我们的产品.
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.
修复它的唯一方法是:<代码>码头工人组合码头工人系统修剪 -fdocker rmi $(docker 图像 -q)码头工人组成拉docker-compose up -d
有什么更好的主意吗?
推荐答案
根据文档,你可以忽略上一卷的数据:
According to the documentation, you can ignore data from previous volume with this:
docker-compose up -d --force-recreate --renew-anon-volumes
参见 https://docs.docker.com/compose/reference/up/一个>
这篇关于docker-compose 继续使用旧的图像内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!