Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
648 views
in Technique[技术] by (71.8m points)

caching - docker-compose keeps using old image content

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.

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).

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

The only way to fix it was: docker-compose down docker system prune -f docker rmi $(docker images -q) docker-compose pull docker-compose up -d

Any better idea ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

docker-compose up -d --force-recreate --renew-anon-volumes

See https://docs.docker.com/compose/reference/up/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...