gpt4 book ai didi

azure - 登录到 Azure Pipeline 中的 Azure 容器注册表

转载 作者:行者123 更新时间:2023-12-02 06:18:31 25 4
gpt4 key购买 nike

我无法按照文档使用任务“DockerCompose@0”登录 Azure 中的容器注册表。

文档建议使用:

variables:
azureContainerRegistry: Contoso.azurecr.io
azureSubscriptionEndpoint: Contoso
steps:
- task: DockerCompose@0
displayName: Container registry login
inputs:
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)

其中,azureSubscriptionEndpoint 是 ARM 服务连接的名称。

我使用了以下管道:

pool:
name: Hosted Ubuntu 1604

variables:
azureContainerRegistry: <ACRName>.azurecr.io
azureSubscriptionEndpoint: <SubscriptionName> (<SubscriptionID>)

steps:

- task: DockerCompose@0
displayName: Container registry login
inputs:
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)

- task: DockerCompose@0
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: '{"loginServer":"<ACRName>.azurecr.io", "id" : "/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/providers/Microsoft.ContainerRegistry/registries/<ACRName>"}'
dockerComposeFile: '<Path>/docker-compose.yml'
action: 'Build services'

- task: DockerCompose@0
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: '{"loginServer":"<ACRName>.azurecr.io", "id" : "/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/providers/Microsoft.ContainerRegistry/registries/<ACRName>"}'
dockerComposeFile: '<Path>/docker-compose.yml'
action: 'Push services'

- task: CopyFiles@2
displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)"
inputs:
SourceFolder: <Path>
Contents: '**\docker-compose.yml'
TargetFolder: "$(Build.ArtifactStagingDirectory)"

- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: drop"

但是,我在管道中收到以下错误:

##[error]Input required: dockerComposeCommand

第一个任务(容器注册表登录)。

我哪里出错了?

最佳答案

我想您不需要构建中的登录步骤,docker 任务使用 azure 订阅端点处理身份验证(如果已预先配置),如果没有 - 向您的服务主体授予 acrpush 权限。

关于azure - 登录到 Azure Pipeline 中的 Azure 容器注册表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61317405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com