【Azure 应用服务】App Service for Container 无法拉取Docker Hub中的镜像替代方案
阅读原文时间:2023年08月22日阅读:1

问题描述

创建App Service Container服务,选择从Docker Hub中获取appsmith/appsmith-ce 镜像(https://www.appsmith.com/ & https://hub.docker.com/r/appsmith/appsmith-ce/tags ), 但访问站点时遇见Application Error错误。查看部署日志,发现问题原因是:

ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

问题解答

在App Service For Container 中,如果选择从Docker Hub中获取镜像,App Service自动配置的Docker Hub Service URL是 https://index.docker.io。 这个地址可以在创建App Service时候的Review页面中获取,也可以从App Service的Configuration页面中的DOCKER_REGISTRY_SERVER_URL设置中查看。

因为在中国区的特殊情况下,当docker.io无法访问或者访问不稳定的情况下,就会出现Image pull failed的情况。

由于无法修改Docker Hub 在App Service中配置的Service URL,所以只有两种办法来缓解这种情况:

1) 把需要的镜像想办法上传到中国区的ACR(Azure Container Registry)中, 这样就不会面临访问拦截的问题。

2) 使用私有镜像库(Private Registry), 在面临Docker Hub(docker.io) 无法从中国区访问的情况,有很多镜像代理库同样可以下载到与Docker Hub相同的镜像文件。

所以,本文中使用的代替访问就是:

使用 Private Registry 并配置代理URL ( https://dockerhub.azk8s.cn/ **)****用于替换 Docker Hub(** https://index.docker.io)

配置修改对比截图:

修改完成后,再次查看日志:

2023-06-19T07:16:29.498Z INFO - Status: Downloaded newer image for dockerhub.azk8s.cn/appsmith/appsmith-ce:release

2023-06-19T07:16:29.501Z INFO - Pull Image successful, Time taken: 3 Minutes and 52 Seconds

拉取镜像成功,验证访问站点,也成功了。

参考资料:

Container Registry Proxy : https://github.com/Azure/container-service-for-azure-china/blob/master/aks/README.md#22-container-registry-proxy

appsmith/appsmith-ce 镜像: https://www.appsmith.com/  or  https://hub.docker.com/r/appsmith/appsmith-ce/tags

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器