1

The task Docker push fail to push the image into docker hub.

The yml:

steps:
- task: Docker@0
  displayName: 'Push an image'
  inputs:
    containerregistrytype: 'Container Registry'
    dockerRegistryConnection: 'docker hub'
    action: 'Push an image'

The log:

Starting: Push an image
==============================================================================
Task         : Docker
Description  : Build, tag, push, or run Docker images, or run a Docker command
Version      : 0.157.0
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/docker
==============================================================================
dbef9fd1-06fb-47eb-af36-bf86b4d44152 exists true
"C:\Program Files\Docker\docker.exe" push azuretp:38
The push refers to repository [docker.io/library/azuretp]
f2369ebe2bed: Preparing
...
537ddf9b819a: Waiting
denied: requested access to the resource is denied
##[error]C:\Program Files\Docker\docker.exe failed with return code: 

The connection docker hub is correct. I just reenter the credentials and Azure pipeline validate it successfully.

The problem seams to be with the path, according to this post, but i can't find a way to specify my docker hub name within this task.

MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
  • I think you need to create a connection for your docker hub first. – Charles Xu Nov 27 '19 at 07:12
  • The problem, is with the image itself. The image tag has to change in order to match repository. Probably won't need to do it if i use azure registry instead docker registry service. – MiguelSlv Nov 27 '19 at 14:38

1 Answers1

3

The push refers to repository [docker.io/library/azuretp]

According to this error message line, seems the task is pushing image to the root level of Docker hub, which is not allowed.


To solve it, please change the task from 0.* to 2.*

And then, input your docker repository name which listed in the Docker repository page by using the format: dockerhub_namespace/RepositoryName:

enter image description here

enter image description here

For YAML, please use below sample:

steps:
- task: Docker@2
  displayName: push
  inputs:
    containerRegistry: {service connection name}
    repository: {dockerhub_namespace/RepositoryName}
    command: push
Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35
  • I was not aware that i could pick a different implementation for the task. One suggestion to Microsoft, make the last version the default. Thank you. – MiguelSlv Nov 29 '19 at 10:24