如何在Azure Devops中使用我自己的Docker注册表?

时间:2019-05-28 03:33:06

标签: azure docker azure-devops devops docker-registry

摘要

我已经添加了project settings-> service connections-> add docker registry,但是当我尝试将docker映像推送到自己的注册表中时,控制台向我显示x509: certificate signed by unknown authority

服务连接配置

Docker Registry https://xxx.xxx.xx:5000/v2
Docker ID   user
Password    ********

管道配置

当前我正在使用Azure Devops中的docker模板

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

steps:
- task: Docker@2
  inputs:
    containerRegistry: 'XXXX'
    repository: 'helloworld'
    command: 'buildAndPush'
    Dockerfile: 'Dockerfile'

但是我也尝试了脚本

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

steps:
  - script: docker build -t xxx.xxx.xx:5000/helloworld:latest .
  - script: docker login -u vauman -p JTeS2w276O79 xxx.xxx.xx:5000
  - script: docker push xxx.xxx.xx:5000/helloworld:latest

两者都不起作用

控制台输出

这是在使用docker模板时的实际控制台结果,我很困惑为什么我的存储库名称的末尾有:3

Successfully built 6a29968xxxfb
Successfully tagged xxx.xxx.xx:5000/helloworld:3
[command]/usr/bin/docker push xxx.xxx.xx:5000/helloworld:3
The push refers to repository [xxx.xxx.xx:5000/helloworld]
Get ***: x509: certificate signed by unknown authority
##[error]Get ***: x509: certificate signed by unknown authority
##[error]/usr/bin/docker failed with return code: 1

1 个答案:

答案 0 :(得分:0)

我发现还有另一个链证书,我必须将其与客户证书结合在一起。

cat client.crt >> chain.crt

效果很好!