azure - Push to docker repository fail on AzurePipelines
问题描述
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://docs.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.
解决方案
推送是指存储库 [docker.io/library/azuretp]
根据此错误消息行,似乎任务是将映像推送到 Docker 集线器的根级别,这是不允许的。
要解决它,请将任务从更改0.*
为2.*
然后,使用以下格式输入您在Docker 存储库页面中列出的 docker 存储库名称dockerhub_namespace/RepositoryName
:
对于 YAML,请使用以下示例:
steps:
- task: Docker@2
displayName: push
inputs:
containerRegistry: {service connection name}
repository: {dockerhub_namespace/RepositoryName}
command: push
推荐阅读
- powershell - 如何判断我当前的 PowerShell 会话是否通过 SSH?
- javascript - SharePoint 2013 客户端自定义 Javascript 搜索框,能够将结果填充到 HTML 表中
- spring-boot - 对于处理遗留问题的微服务架构,什么是有据可查的缓存策略模式?
- wordpress - Isotope 在 wordpress 上的布局损坏,但可以在另一个测试页面上使用
- c# - 从过时的 FragmentManager 过渡到 Android.Support.V4.App
- python - 如何下载 Python 的 PolyFrag 模块?
- android - 实施指向我的应用的深层链接后,应用图标未出现
- amazon-web-services - 如何使用 .env 文件为 Springboot 应用程序使用环境变量?
- java - 我想让后台服务每 24 小时将项目添加到 RecyclerView
- sql - 如何将存储过程结果传递给变量