Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect if there's a new docker image without using docker pull?

I want to pull and restart a docker service everyday at the same time but only if there's a new image available. Is there a docker command that returns true where I can run my update service?

Eg something like

docker new-update-available myname/myimage && ./myupdateandrestart.sh
like image 535
Jazz Man Avatar asked Oct 21 '25 13:10

Jazz Man


1 Answers

You only need two commands (or a very simple shell script):

docker-compose pull
docker-compose up -d

The pull retrieves all updated images defined in your docker-compose.yml. And the up will restart any containers if they are running on older images, but otherwise leave a running instance of your application alone.

like image 107
BMitch Avatar answered Oct 23 '25 04:10

BMitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!