Hi,
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 = docker.build("test/hellonode")
}
stage('Test image') {
app.inside {
sh 'node --version'
}
}
stage('Push image') {
docker.withRegistry('
http://test.xyz-europe.com', 'test-dtr') {
/* app.push("${env.BUILD_NUMBER}") */
app.push("latest")
}
}
}
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
test.xyz-europe.com/test/hellonode:latestunknown flag: --force
See 'docker tag --help'.
+ docker tag test/hellonode
test.xyz-europe.com/test/hellonode:latest[Pipeline] sh
[docker-hellonode] Running shell script
+
docker push test.xyz-europe.com/test/hellonode:latest
The push refers to a repository [test.xyz-europe.com/test/hellonode]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
test.xyz-europe.com' first
What do I misconfigured? can somebody advise me here?
Regards
Walter