How to deploy to azure web app containers using a docker hub registry

1.3k views Asked by At

As part of my azure pipelibe I build a docker image and push it to my docker hub registry. Then I would need to deploy it to an Azure Web App for Containers and for that I have been trying to add the code below:

- stage: Deploy
displayName: Deploy to App Service
jobs:
  - job: Deploy
    displayName: Deploy
    pool:
      vmImage: 'ubuntu-latest'
    steps:
      - task: AzureRmWebAppDeployment@4
        inputs:
          ConnectionType: 'AzureRM'
          azureSubscription: $(azureSubscription)
          appType: 'webAppContainer'
          WebAppName: $(webappName)
          DockerNamespace: 'https://index.docker.io/v1'
          DockerRepository: 'my_id/name_of_my_image'
          DockerImageTag: $(tag)

But I keep receiving the below error on the portal logs in the container settings

ERROR - DockerApiException: Docker API responded with status code=BadRequest, response={"message":"invalid reference format"}

The repo is private but I have tried to change it to public and that didn't work either, and I have a connection service to docker hub and the app settings, not sure if were needed, have the correct values

app settings

I have found much more documentation when using azure registry but the few I found for docker hub hasn't helped me so would appreciate it if someone knows what to do here

Thanks

1

There are 1 answers

0
mitomed On BEST ANSWER

Just trial and error, it seems to work with the wokspace being 'index.docker.io'. I might understand not needig 'https://', as there is a reference to "high level domain" (although in some of the several places I was checking read something about not needing it in docker hub but need it elsewhere)

Not needind the v1 segment surprises me, though

But it works