且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何检查我的本地docker映像是否已过时,而不从其他地方推送?

更新时间:2023-02-25 07:36:56

如果您使用的是Docker Hub,则可以使用Webhook通知Docker主机有关更新的信息,并对此采取措施.

使用webhook是做到这一点的简单"方法(我认为),否则,您将不得不在docker pull中进行某种爬网,或者像@alebianco解释的那样比较一些哈希或构建/创建日期./p>

以下是有关此文档的文档: https://docs.docker.com/docker -hub/webhooks/

I'm running a react app in a docker container, on a Coreos server. Let's say it's been pulled from dockerhub from https://hub.docker.com/r/myimages/myapp.

Now I want to check periodically if the dockerhub image for the app container has been updated, to see if the image I'm running locally is behind.

What would be the most efficient way to check if a local docker image is outdated compared to the remote image? All solutions I've found so far are bash scripts or external services that push on an update. I'd like to find a solution that is as native to docker as possible, and would like to refrain from pushing a notification from somewhere else (to alert the server of an updated image).

If you are using Docker Hub you could use a Webhook to notify the docker host about a update, and take action over that.

Using the webhook would be the "simple" way to do it (I think) otherwise you would have to do some kind of crawling in the docker pull or as explained by @alebianco comparing some hashs or build/creation dates.

Here is the docs about it: https://docs.docker.com/docker-hub/webhooks/