In my Jenkins pipeline I had my docker plugin configured as such:

      docker.withRegistry('https://registry.hub.docker.com', 'my-docker-hub-cred') {
          sh "docker load -i ${WORKSPACE}/my-image.tar"   
          docker.image("my-image:latest").push()
      } 

       

      It worked fine so far. Notice the URL I used for the `withRegistry` call (https://registry.hub.docker.com).
      In order to support some multi-arch images I had to introduce some different docker commands such as `docker manifest`

      So it ended up like this:

      docker.withRegistry('', 'my-docker-hub-cred') 
          sh "docker load -i ${WORKSPACE}/my-image-amd64.tar"
          sh "docker load -i ${WORKSPACE}/my-image-arm64.tar"
      
          docker.image("my-image:latest-amd64").push() 
          docker.image("my-image:latest-arm64").push() 
      
          sh "docker manifest create my-image:latest --amend my-image:latest-amd64 --amend my-image:latest-arm64"                        
          sh "docker manifest push my-image:latest"
      
      } 

       

      If you notice, I've had to remove the URL `https://registry.hub.docker.com` from the Docker plugin withRegistry method. Otherwise I get the following error every time I try to push the images:

      22:51:16  denied: requested access to the resource is denied
      22:51:16  unauthorized: authentication required

      I tried out by using the following URLs but none of them actually worked:

          [JENKINS-72376] docker.withRegistry fails to login

          Antonio created issue -
          Antonio made changes -
          Description Original: In my Jenkins pipeline I had my docker plugin configured as such:



           
          {code:java}
          docker.withRegistry('https://registry.hub.docker.com', 'my-docker-hub-cred') {
              sh "docker load -i ${WORKSPACE}/my-image.tar"  
              docker.image("my-image:latest").push()
          } {code}

          It worked fine so far. Notice the URL I used for the `withRegistry` call (https://registry.hub.docker.com).
          In order to support some multi-arch images I had to introduce some different docker commands such as `docker manifest`

          So it ended up like this:


          {code:java}
          docker.withRegistry('', 'my-docker-hub-cred')
              sh "docker load -i ${WORKSPACE}/my-image-amd64.tar"
              sh "docker load -i ${WORKSPACE}/my-image-arm64.tar"

              docker.image("my-image:latest-amd64").push()
              docker.image("my-image:latest-arm64").push()

              sh "docker manifest create my-image:latest --amend my-image:latest-amd64 --amend my-image:latest-arm64"
              sh "docker manifest push my-image:latest"

          } {code}
           

           

           

           

          If you notice, I've had to remove the URL `https://registry.hub.docker.com` from the Docker plugin withRegistry method. Otherwise I get the following error every time I try to push the images:



           
          {noformat}
          22:51:16  denied: requested access to the resource is denied
          22:51:16  unauthorized: authentication required{noformat}

          I tried out by using the following URLs but none of them actually worked:
           * [https://registry.hub.docker.com|https://registry.hub.docker.com/]
           * [https://docker.io|https://docker.io/]
           * [https://registry.hub.docker.com/v2]
           * [https://index.docker.io|https://index.docker.io/]

           

           
          New: In my Jenkins pipeline I had my docker plugin configured as such:
          {code:java}
          docker.withRegistry('https://registry.hub.docker.com', 'my-docker-hub-cred') {
              sh "docker load -i ${WORKSPACE}/my-image.tar"  
              docker.image("my-image:latest").push()
          } {code}
           

          It worked fine so far. Notice the URL I used for the `withRegistry` call ([https://registry.hub.docker.com|https://registry.hub.docker.com/]).
          In order to support some multi-arch images I had to introduce some different docker commands such as `docker manifest`

          So it ended up like this:
          {code:java}
          docker.withRegistry('', 'my-docker-hub-cred')
              sh "docker load -i ${WORKSPACE}/my-image-amd64.tar"
              sh "docker load -i ${WORKSPACE}/my-image-arm64.tar"

              docker.image("my-image:latest-amd64").push()
              docker.image("my-image:latest-arm64").push()

              sh "docker manifest create my-image:latest --amend my-image:latest-amd64 --amend my-image:latest-arm64"
              sh "docker manifest push my-image:latest"

          } {code}
           

          If you notice, I've had to remove the URL `[https://registry.hub.docker.com|https://registry.hub.docker.com/]` from the Docker plugin withRegistry method. Otherwise I get the following error every time I try to push the images:
          {noformat}
          22:51:16  denied: requested access to the resource is denied
          22:51:16  unauthorized: authentication required{noformat}
          I tried out by using the following URLs but none of them actually worked:
           * [https://registry.hub.docker.com|https://registry.hub.docker.com/]
           * [https://docker.io|https://docker.io/]
           * [https://registry.hub.docker.com/v2]
           * [https://index.docker.io|https://index.docker.io/]
          Jesse Glick made changes -
          Component/s New: docker-workflow-plugin [ 20625 ]
          Component/s Original: docker [ 20834 ]
          Component/s Original: docker-plugin [ 18724 ]
          Jesse Glick made changes -
          Assignee Original: Carlos Sanchez [ csanchez ]
          Jesse Glick made changes -
          Labels Original: docker jenkins plugin

            Unassigned Unassigned
            afalhambra Antonio
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: