title: Can not push Docker Image to Artifactory in Jenkins pipeline using Artifactory plugin
body: <p>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.</p>
  
  <p>The image is called <code>registry-url/docker/image:latest</code>.
  I have a docker repository on Artifactory which is called <code>docker</code>. (I'm able to pull and push to this repo using docker commands).</p>
  
  <p>This stage describes my Artifactory configuration:</p>
  
  <pre><code>...
          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
                  }
              }
          }
  ...
  </code></pre>
  
  <p>When I use different paths I face the <code>manifest.json</code> error which is probably normal.
  I'm able to download the manifest.json manually on: <code>https://registry-url/artifactory/docker/image/latest/manifest.json</code>.</p>
  
  <p>I'm using a pretty new version of Docker on Jenkins:</p>
  
  <pre><code>Docker version 18.01.0-ce, build 03596f51b1
  </code></pre>
  
  <p>So far so good. But When I run the pipeline I receive the following error in Jenkins (it takes 50 seconds):</p>
  
  <pre><code>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)
    ...
  </code></pre>
  
  <p>In Artifactory logs I see:</p>
  
  <pre><code>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'
  </code></pre>
  
  <p>What am I missing or doing wrong?</p>
  
  <p><strong>EDIT:</strong>
  Based on this <a href="https://www.jfrog.com/jira/browse/RTFACT-16074" rel="nofollow noreferrer">issue</a> I went back to my initial idea:</p>
  
  <pre><code>def buildInfo = rtDocker.push('registry-url/docker/image:latest', 'docker') 
  </code></pre>
  
  <p>I tried the build again. Error:</p>
  
  <pre><code>Could not find manifest.json in Artifactory in the following path: https://registry-url/artifactory/docker/docker/image/latest/manifest.json
  </code></pre>
  
  <p>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.</p>
  
  <p>Artifactory Plugin: 2.15.1<br>
  Artifactory Version: 5.10.3</p>
  
  <p>Is this really a bug which will be fixed soon?</p>