Jenkins test pipeline docker build + push

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Jenkins test pipeline docker build + push

Walter Heestermans

I'm new in Jenkins and trying to run a pipeline to get source from github, build docker image, test docker image and push image to local docker repository.

node {
    def app
    stage('Clone repository') {
        checkout scm
    stage('Build image') {
        app ="test/hellonode")
    stage('Test image') {
        app.inside {
            sh 'node --version'
    stage('Push image') {
        docker.withRegistry('', 'test-dtr') {
     /* app.push("${env.BUILD_NUMBER}") */

Repository 'test/hellonode' is created inside the local docker repository.

The credentials 'test-dtr' are created inside Jenkins: Jenkins --> Credentials --> System --> Global credentials (unrestricted)

All stages goes fine, except the push. The push is initiated, but seems that the credentials are not taken, I don't see any docker login neither?

Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Push image)
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
Wrote authentication to /var/jenkins_home/.dockercfg
[Pipeline] {
[Pipeline] sh
[docker-hellonode] Running shell script
+ docker tag --force=true test/hellonode
unknown flag: --force
See 'docker tag --help'.
+ docker tag test/hellonode
[Pipeline] sh
[docker-hellonode] Running shell script
+ docker push
The push refers to a repository []

81c1e1c37cf0: Preparing
8455c73a933d: Preparing
41d2e9b986ab: Preparing
cdd2b48b0e16: Preparing
072b714c90b8: Preparing
ea2e97e9408f: Preparing
0da372da714b: Preparing
bf3841becf9d: Preparing
63866df00998: Preparing
2f9128310b77: Preparing
d9a5f9b8d5c2: Preparing
c01c63c6823d: Preparing
0da372da714b: Waiting
bf3841becf9d: Waiting
63866df00998: Waiting
2f9128310b77: Waiting
d9a5f9b8d5c2: Waiting
c01c63c6823d: Waiting
ea2e97e9408f: Waiting
denied: requested access to the resource is denied

The reason seems to be that the login is not done or taken. same issues when I do the above push via command line and not executing a 'docker login' first

What do I misconfigured? can somebody advise me here?


You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit
For more options, visit