Azure Web应用程序在拉取Docker容器时失败

x6492ojm  于 12个月前  发布在  Docker
关注(0)|答案(1)|浏览(176)

我有一个带有Docker容器的Web应用程序。我添加Azure容器注册表并添加到应用程序。我还启用了管理员用户在容器中。然后我使用以下命令:

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

之后,我连接Github的行动和部署是成功的。但在那之后,我总是得到错误:

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.

我试着不采取行动,但没有帮助。我也有配置中的所有值。我试着用azurecli登录,命令是:
az acr login --name clothinginsecuritydocker.azurecr.io

nzk0hqpo

nzk0hqpo1#

  • 尝试以下步骤来解决问题:*
  • 确保Docker配置正确设置,并确保Docker CLI and daemon在您的环境中运行。
  • Registry name或您正在使用的credentials应该是正确的。
  • 在运行docker login时,请确保注册表登录服务器名称、用户名和密码有效。

  • 尝试为您的注册表启用公共网络访问或允许从Selected Networks访问,如特定的虚拟网络或IP地址。

  • 检查您是否具有从注册表推送或拉取图像所需的权限,例如分配给用户或服务主体的AcrPushAcrPull角色。
  • 从Azure容器注册表中删除Docker镜像并再次推送。您可以使用以下命令删除Docker镜像:
docker rmi <Image_Name>
docker push <Image_Name>

相关问题