I am unable to follow the documentation for logging into my container registry in Azure using the task "DockerCompose@0".
The documentation suggests to use:
variables:
azureContainerRegistry: Contoso.azurecr.io
azureSubscriptionEndpoint: Contoso
steps:
- task: DockerCompose@0
displayName: Container registry login
inputs:
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
Where azureSubscriptionEndpoint is the name of the Service Connection for ARM.
I used the following pipeline:
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"
However, I am receiving following error in my pipeline:
##[error]Input required: dockerComposeCommand
for the the first task (Container registry login).
Where am I going wrong?
I guess you don't need the login step from your build, docker tasks handle Auth using azure subscription endpoint if it is pre configured, if not - give your service principal permissions to acrpush.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With