Azure web app fails when pull docker container

417 Views Asked by At

I have web app with docker container. I add Azure Container registry and add to app. Also I enabled admin user in container. Then i use following command:

docker build -t clothinginsecuritydocker.azurecr.io/prod:latest
docker login clothinginsecuritydocker.azurecr.io
docker push clothinginsecuritydocker.azurecr.io/prod:latest

After that i connect github actions and deploy was success. But after that I always get the error:

2023-10-09T16:17:45.672Z ERROR - failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped to a host IDErr: 0, Message: failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped to a host ID
2023-10-09T16:17:45.694Z INFO - Pull Image failed, Time taken: 0 Minutes and 47 Seconds
2023-10-09T16:17:45.695Z ERROR - Pulling docker image clothinginsecuritydocker.azurecr.io/clothinginsecuritydocker/prod:ba2cad09552128b3aabfc6a7d526c71dd4adc7d4 failed:
2023-10-09T16:17:45.988Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Head \"https://clothinginsecuritydocker.azurecr.io/v2/clothinginsecuritydocker/prod/manifests/ba2cad09552128b3aabfc6a7d526c71dd4adc7d4\": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."}
2023-10-09T16:17:45.989Z WARN - Image pull failed. Defaulting to local copy if present.
2023-10-09T16:17:45.999Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2023-10-09T16:17:46.009Z INFO - Stopping site clothinginsecurityserver because it failed during startup.

I tried to do it without actions it didn't help. I have all values in configuration as well. I tried to login with azurecli with command:

az acr login --name clothinginsecuritydocker.azurecr.io

1

There are 1 best solutions below

5
On

Try below steps to fix the issue:

  • Make sure Docker configuration is set up properly and ensure that Docker CLI and daemon are running in your environment.
  • Registry name or the credentials you are using should be correct.
  • Make sure the registry login server name, username, and password are valid, when you run docker login.

enter image description here

  • Try enabling public network access for your registry or allow access from Selected Networks like specific virtual networks or IP addresses.

enter image description here

  • Check if you have the required permissions to push or pull images from your registry, like AcrPush or AcrPull role assigned to your user or service principal.

  • Delete the Docker image from your Azure Container Registry and push it again. You can use the following commands to delete the Docker image:

docker rmi <Image_Name>
docker push <Image_Name>