I'm using a Docker Registry on Artifactory. I'm able to pull/push images using docker commands. Now I try to push an image using a Jenkins pipline.
The image is called registry-url/docker/image:latest
.
I have a docker repository on Artifactory which is called docker
. (I'm able to pull and push to this repo using docker commands).
This stage describes my Artifactory configuration:
...
stage('Deploy Docker image'){
steps {
script {
def server = Artifactory.server 'xxx'
def rtDocker = Artifactory.docker server: server
def buildInfo = rtDocker.push('registry-url/image:latest', 'docker')
//also tried:
//def buildInfo = rtDocker.push('registry-url/docker/image:latest', 'docker')
//the above results in registry/docker/docker/image..
server.publishBuildInfo buildInfo
}
}
}
...
When I use different paths I face the manifest.json
error which is probably normal.
I'm able to download the manifest.json manually on: https://registry-url/artifactory/docker/image/latest/manifest.json
.
I'm using a pretty new version of Docker on Jenkins:
Docker version 18.01.0-ce, build 03596f51b1
So far so good. But When I run the pipeline I receive the following error in Jenkins (it takes 50 seconds):
Pushing image: registry-url/image:latest
...
com.github.dockerjava.api.exception.DockerClientException: Could not push image: unknown: Not Found
at com.github.dockerjava.core.command.PushImageResultCallback.awaitSuccess(PushImageResultCallback.java:49)
at org.jfrog.hudson.pipeline.docker.utils.DockerUtils.pushImage(DockerUtils.java:60)
at org.jfrog.hudson.pipeline.docker.utils.DockerAgentUtils$3.call(DockerAgentUtils.java:213)
at org.jfrog.hudson.pipeline.docker.utils.DockerAgentUtils$3.call(DockerAgentUtils.java:205)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
...
In Artifactory logs I see:
2018-04-25 14:24:26,663 [http-nio-8081-exec-xx] [ERROR] (o.a.a.d.r.DockerResource:153) - Unsupported docker v2 repository request for 'image'
2018-04-25 14:24:46,684 [http-nio-8081-exec-xx] [ERROR] (o.a.a.d.r.DockerResource:153) - Unsupported docker v2 repository request for 'image'
2018-04-25 14:24:46,689 [http-nio-8081-exec-xx] [ERROR] (o.a.a.d.r.DockerResource:153) - Unsupported docker v2 repository request for 'image'
2018-04-25 14:24:46,702 [http-nio-8081-exec-xx] [ERROR] (o.a.a.d.r.DockerResource:153) - Unsupported docker v2 repository request for 'image'
What am I missing or doing wrong?
EDIT: Based on this issue I went back to my initial idea:
def buildInfo = rtDocker.push('registry-url/docker/image:latest', 'docker')
I tried the build again. Error:
Could not find manifest.json in Artifactory in the following path: https://registry-url/artifactory/docker/docker/image/latest/manifest.json
Two times 'docker' in the path and it seems not to work. BUT when I check in Artifactory the image is there... I can also pull the image. It seems to be fine but still the jenkins build is failing.
Artifactory Plugin: 2.15.1
Artifactory Version: 5.10.3
Is this really a bug which will be fixed soon?