Is there a way to push a docker image to a registry, without doing the docker.build part?
Context: This is a project built with spring boot using jdk17 and basically the image is being built but we still need to push this to our private registry.
Side note: we only work with scripted pipelines
What you normally do is something similar to this (which we’re already doing in other projects):
docker.withRegistry('https://registry.example.com', 'credentials-id') {
def customImage = docker.build("my-image:${env.BUILD_ID}")
/* Push the container to the custom Registry */
customImage.push()
}
But we don’t need this part docker.build("my-image:${env.BUILD_ID}")
and cant find a way of doing push() without it. We’re not using Dockerfiles.
Every piece of documentation I’ve found so far uses the docker.build part. I’m really running out of ideas and solutions for this.
Thanks in advance!!