Docker Community Forums

Share and learn in the Docker community.

In Jenkins using Docker Build and Publish / job keeps failing

(Bhupendrajal) #1

I am trying to use the Cloudbees Docker Build plugin for Jenkins. I am using a free version of Jenkins 2.1 on RedHat Linux. The server has access to the internet. I can log into DockerHub from the command line on the backend.

I am trying to run the most simple job possible in Jenkins with a “Docker Build and Publish” step. I see this as the Console Output of a failed Jenkins job:

Started by user John Doe
Building in workspace /var/lib/jenkins/workspace/simplejob
[simplejob] $ docker build -t --pull=true /var/lib/jenkins/workspace/simplejob
Sending build context to Docker daemon 2.048kB

Step 1/3 : FROM ubuntu:latest
latest: Pulling from library/ubuntu
Digest: sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68
Status: Image is up to date for ubuntu:latest
—> 1d9c17228a9e
—> Using cache
—> 1470da128b83
Step 3/3 : RUN apt-get -y update && apt-get -y upgrade && apt-get install -y build-essential
—> Using cache
—> ea970f71d357
Successfully built ea970f71d357
Successfully tagged namea:nameb
[simplejob] docker tag ea970f71d357 index.docker. [spaceinserted for posting reasons] io/namea:latest [simplejob] docker inspect ea970f71d357
[simplejob] $ docker push index.docker. [spaceinserted for posting reasons] io/namea:nameb
The push refers to a repository [docker. [spaceinserted for posting reasons] io/library/namea]
fd199445295b: Preparing
2c77720cf318: Preparing
1f6b6c7dc482: Preparing
c8dbbe73b68c: Preparing
2fb7bfc6145d: Preparing
denied: requested access to the resource is denied
Build step ‘Docker Build and Publish’ marked build as failure
Finished: FAILURE

I think my credentials and configuration are correct in Jenkins. When I use an incorrect set of credentials for Dockerhub in Jenkins, the job fails with “unauthorized: incorrect username or password” Is there something that I can do on the backend to test everything? Why would access to a resource be denied? I believe the Dockerhub credentials I gave were correct.