Search code examples
dockerjenkins-pipelinejenkins-2

Error response from daemon: pull access denied for TestDockerImage


I am new to docker and Jenkins2. I am trying to pull docker image from private docker repository.

pipeline {
         agent{
            docker{
                image "PrivateRepo/Test"
                args "--username testUser --password pass -v /var/jenkins_home/workspace:/home --env "
            }
        }
        stages {
                .
                .
                .
               }
 }

when I run Jenkins file it gives me below error

Error response from daemon: pull access denied for PrivateRepo/Test, repository does not exist or may require 'docker login'

Where do I give docker credential or how can I provide access to repository.


Solution

  • The registry "PrivateRepo" requires a login to all pulling images from it. If you have access to the machine where jenkins is running, you can simply do that by executing:

    docker login PrivateRepo
    

    Alternatively, you can do it from jenkins as described in here.