declarative: how can agent { docker { image 'foo:latest' }} really get the latest version?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

declarative: how can agent { docker { image 'foo:latest' }} really get the latest version?

Matt Stave
If you run such a job the 1st time, all is well.
If you run it again, it may or may not decide to grab the latest version vs. use the one it already has.

I'm not sure if it's finding it on the Jenkins master, or on a local worker.

In my case it's an image built and pushed to a local repo by another Jenkins job, but the job that wants to use it runs independently.

A workaround is to skip using agent to get the image, and do a docker pull (which WILL get the latest one), docker run inside a node{}, but that seems kludgey, as does some sort of agent .. docker:dind + docker.pull, docker.inside ...

If you're using the Docker plugin to have docker-based slaves (which we're not), there's a "pull strategy" config option that has a lovely-sounding "pull once and update latest" option, fwiw.

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9fbf5c04-4a34-4007-b2c4-3fbeb08ed872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.