0

I'm trying to setup a script for automate the creation of a new environment for my app, and i need a docker webapp. The problem is that i need to pull the image from docker hub. When i create an env from the interface in juste setup it like that : Screen of a docker configuration

The problem is that i don't find out how i can configure the "Source de registre" on Docker Hub by the az cli.

For now the command i'm using to create a new web app ressource is this one

az webapp create -g name_of_group -p name_of_plan -n resource-test2 -i https://registry.hub.docker.com/publisher/name_of_image:version -s name_of_image -w my_password

The problem of this command is that it give me this configuration

Screenshot of a configuration

Which doesn't work because i can't get logged in (probably because it's not configured as a Docker Hub registre).

Do you know how i can specify this configuration in my az cli command ? Thanks

2 Answers2

0

To deploy the images stored in a private registry or the Docker Hub, you can set the environment variables below:

  • DOCKER_REGISTRY_SERVER_USERNAME - The username for the ACR server.
  • DOCKER_REGISTRY_SERVER_URL - The full URL to the ACR server. (For example, https://my-server.azurecr.io.)
  • DOCKER_REGISTRY_SERVER_PASSWORD - The password for the ACR server.

Get more details here. And you can use the CLI command az webapp config appsettings set to do it.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
0

Recently had the same problem deploying azure cloud webapp from a container in my private docker hub repo. UI experience works fine but when I do it using azure cli with 'az webapp create ...' ended up with same problem. I was able to fix it by using 'az webapp config container set ...' command after creating the webapp. See below and in my github repo

# First create the webapp with a docker container:
~$ az webapp create -n $webAppName -g $resGroup -p $servicePlan -i $containerImg -s $dockerUsr -w $dockerPass --tags Lifecycle=Test
# Update docker container settings with your private docker hub repo credentials:
~$ az webapp config container set --name $webAppName --resource-group $resGroup --docker-custom-image-name 'DOCKER|dockeruser/myrepo:tweb1' --docker-registry-server-url 'https://index.docker.io/v1' --docker-registry-server-user 'dockeruser' --docker-registry-server-password 'xxxxxxxxxxx'