DockerApiException - unauthorized: incorrect username or password

Viewed 324

I have an app in Angular/Nest.js deployed on Azure. It has been working fine for the last few months but today it suddenly started showing these errors:

On frontend it is showing CORS errors but on the backend I see this:

2022-06-06T06:06:39.208Z INFO  - Starting multi-container app..
2022-06-06T06:06:39.556Z INFO  - Pulling image: example.azurecr.io/example_backend_uat_github:latest
2022-06-06T06:06:42.254Z INFO  - latest Pulling from example_backend_uat_github
2022-06-06T06:06:42.255Z INFO  -  Digest: sha256:fbc2we4g67c865c345567098775ed5fec4aecd7285e4fce947223d3262c901de
2022-06-06T06:06:42.256Z INFO  -  Status: Image is up to date for example.azurecr.io/example_backend_uat_github:latest
2022-06-06T06:06:42.258Z INFO  - Pull Image successful, Time taken: 0 Minutes and 2 Seconds
2022-06-06T06:06:42.270Z INFO  - Starting container for site
2022-06-06T06:06:42.271Z INFO  - docker run -d -p 1496:3000 --name example-portal-backend-uat_backend_0_01449c14 -e WEBSITE_CORS_ALLOWED_ORIGINS=https://example-portal-uat.azurewebsites.net -e WEBSITE_CORS_SUPPORT_CREDENTIALS=True -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=3000 -e WEBSITE_SITE_NAME=example-portal-backend-uat -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=example-portal-backend-uat.azurewebsites.net -e WEBSITE_INSTANCE_ID=some-random-id -e HTTP_LOGGING_ENABLED=1 -e WEBSITE_USE_DIAGNOSTIC_SERVER=False example.azurecr.io/example_backend_uat_github:latest
2022-06-06T06:06:42.334Z INFO  - Pulling image: redis
2022-06-06T06:06:44.051Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://registry-1.docker.io/v2/library/redis/manifests/latest: unauthorized: incorrect username or password"}
2022-06-06T06:06:44.052Z ERROR - Pulling docker image redis failed:
2022-06-06T06:06:44.053Z WARN  - Image pull failed. Defaulting to local copy if present.
2022-06-06T06:06:44.056Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2022-06-06T06:06:44.057Z ERROR - multi-container unit was not started successfully
2022-06-06T06:06:44.059Z INFO  - Container logs from example-portal-backend-uat_backend_0_01449c14 =
2022-06-06T06:06:44.088Z INFO  - Container logs from example-portal-backend-uat_redis_0_01449c14 =
2022-06-06T06:06:44.337Z INFO  - Stopping site example-portal-backend-uat because it failed during startup.

We didn't make any update. I saw a similar post and I verified that:

  • In my Container Register, I have Admin enabled
  • I have set DOCKER_REGISTRY_SERVER_PASSWORD, DOCKER_REGISTRY_SERVER_URL and DOCKER_REGISTRY_SERVER_USERNAME in my App Service Configuration

Is there anything else I should check?

1 Answers

Apparently Microsoft Azure changed the way multi-container apps authenticate to third-party images providers. Pending a more long-term solution, you can change references to images to use an internal reference. For example for redis that would be:

docker-compose.yaml
-------------------
  services:
    redis: <path/to/your/ACR/image:version>
    # instead of pulling from a public repo:
    # redis: redis:latest

Of course you need to push the third-party images to a private registry first.

Related