How can I pull images from ibm registry by using ibm entitlement key?

I tried to pull images from ibm registry to our local network by Jenkins. But I only have an available ibm entitlement key which has the access to the registry. How could I config my Jenkins so I can pull the image by Jenkins? Thanks

Hello @inthefeather and welcome to this community! :wave:

Do you have an agent that can run Docker?
Iā€™m not convinced that this solution embryo is really helpful, as it would require using the same agent to work with the pulled image. :thinking:

pipeline {
  agent any
  stages {
    stage('Pull Image') {
      steps {
        withCredentials([
          usernamePassword(
            credentialsId: 'your-credentials-id',
            usernameVariable: 'REGISTRY_USERNAME',
            passwordVariable: 'REGISTRY_PASSWORD'
          )
        ]) {
          // Authenticate with the IBM registry using the credential
          sh "docker login -u ${REGISTRY_USERNAME} -p ${REGISTRY_PASSWORD} <registry-url>"
          
          // Pull the Docker image from the IBM registry
          sh "docker pull <registry-url>/<image-name>"
        }
      }
    }
    // Other stages...
  }
}

I only have an IBM entitlement key rather than id and password. But I can get you suggestion and I will try it. Thanks a lot

1 Like