Issue
I am running two VMs. One VM is used for running nextflow, on the other VM there is a Jenkins build server. Jenkins is responsible for building new Docker images and pushing new Docker images to our private google container registry.
My nextflow.config
file looks something like this:
process {
withLabel: awesome_image {
container = "eu.gcr.io/best-project-1234/coolest_os:latest"
}
}
After building a new image using the Jenkins server I was running a new nextflow script and I noticed that nextflow was still using the old image. After some research (https://stackoverflow.com/a/58539792/1820480), I realized that this has to do with the fact that I am using the latest
tag, and since there is already an image called latest on the nextflow VM, nextflow uses that one and does not bother checking the registry.
Question: How can I ensure that before every run of nextflow, it checks the registry for newer images? Or, is there a script/program that I can run on the VM that checks the registry (instead of nextflow)?
Thank you.
Solution
Nextflow just runs your command(s) in a container using docker run
. If you specify an image that you haven't pulled yet, docker run
will first do a docker pull
to download/localize the image. To check the registry again for newer images, you'll just need to make sure you call docker pull
(for each image) before running Nextflow. If you want to instead check the registry for newer images each time a process is spawned, please see below.
After some research, it looks like the latest Docker cli (v20.10.0) now has a flag to modify the pull behavior when running containers:
--pull string Pull image before running ("always"|"missing"|"never") (default "missing")
This is nice because it means it should now be possible pass this through in your nextflow.config
:
docker {
enabled = true
runOptions = '--pull=always'
}
But this will have the overhead of doing a docker pull
for each process spawned and, depending on when new images are pushed to your registry, may mean some processes get different containers during your workflow execution. This may not be a concern though if you only need the 'latest' containers and do not care for reproducibility.
Answered By - Steve