gradle-docker-plugin icon indicating copy to clipboard operation
gradle-docker-plugin copied to clipboard

DockerBuild task fails when it needs to pull from multiple private registries

Open SinghDivneet opened this issue 2 years ago • 4 comments

Expected Behavior

It should pull the image from ironbank

Current Behavior

Unable to authorize against ironbank harbor

Context

Trying to pull a private docker image from ironbank harbor but unable to do so

Steps to Reproduce (for bugs)

I am running into an issue to pull an image from harbour & defining the following does nothing for me.

docker {
  registryCredentials {
    url = ironbankDockerRegistryUrl
    username = ironbankDockerRegistryUsername
    password = ironbankRegistryPassword
    email = ironbankDockerRegistryEmail
  }
}

The task below is where I want to use the said registry credentials

task ubidockerBuildImage(type: DockerBuildImage) {
  description = 'Builds an image using the Docker daemon for the current build.'
  dependsOn UBIsyncDockerBuildContext
  inputDir = file(dockerBuildContextDir)
  dockerFile = file("${dockerBuildContextDir}/UBI/Dockerfile")
  buildArgs = ['DPM_VERSION': version, 'BUILD_NUMBER': buildNumber == null ? '1' : buildNumber, 'GIT_REVISION' : "${revision}"]
  images = ["${dockerImageName}:${version}-ubi"]
}

A similar issue where it was closed with a solution #545

Your Environment

plugin version used 6.1.3

Jenkinsfile calling a gradle build and yes all the variables are being passed by jenkins

SinghDivneet avatar Sep 27 '22 13:09 SinghDivneet

We have a functional test for Harbor specifically. I just ran it and it works fine for me. You may want to have a look at it.

What error do you see? We'd need to see the output from the failed task.

bmuschko avatar Sep 27 '22 18:09 bmuschko

I got it to work, I just to make sure the correct context was being picked up. Thanks

SinghDivneet avatar Sep 30 '22 10:09 SinghDivneet

From the looks of it, I need to log in to multiple registries to pull images for multi-staged build & when I login into the second one I am unable to pull the image from the 1st store

SinghDivneet avatar Oct 10 '22 11:10 SinghDivneet

Can you provide a sample project so I have a better idea of how this looks like?

bmuschko avatar Oct 16 '22 00:10 bmuschko

Closing as I haven't heard back from you. Let me know if you need further assistance.

bmuschko avatar Oct 20 '22 15:10 bmuschko