简体   繁体   中英

Force docker compose to pull latest image for a container

I've a system running on docker, my system has an specific test environment which might need to update the image version several times on a day...

So every time a new version need to be placed, i need to open the compose.yml file, look the container and edit the image version, then re-run docker compose up -d

So to skip this boring process of edit the compose.yml file, I had one idea: in the pipeline which builds and publishes the docker image, i create a new tag $image_name:latest-test and a new step which publishes the image to this tag

so on any image update in my pipeline two tags are created, one with the version number and other with the latest-test... both are published to dockerhub and this process works like a charm

but even when a new image is published to dockerhub and i run docker compose up -d no matter if the container is running or not, docker doesn't check if the image we have cached is really the one on dockerhub... it assumes the cache is the latest one and dont update

THE QUESTION IS:

1 - is there any way to force docker to check if the cached image has been updated on dockerhub?
2 - is there any other workaround i can do to keep a specific tag on my compose.yml file and update the image when needed without needing to edit the file 1000 times a day?

thanks

is there any way to force docker to check if the cached image has been updated on dockerhub?

No.

is there any other workaround i can do to keep a specific tag on my compose.yml file and update the image when needed without needing to edit the file 1000 times a day?

Just use latest and use docker-compose pull to pull the images.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM