在已安装体积的天蓝色容器上找不到错误

时间:2019-09-18 08:20:57

标签: azure docker

我已使用以下CLI在Azure上部署了一个Docker容器:

/home/luis/bin/az container create \
    --resource-group mlcontainers2 \
    --name modeldiagnosticsvolume \
    --image mlcontainers2.azurecr.io/samples/modeldiagnostics \
    --registry-login-server mlcontainers2.azurecr.io \
    --registry-password XXXXXXXXXXXXXXXXXXXXXXXX   \
    --registry-username mlcontainers2 \
    --ports 80 5000 5100 \
    --ip-address public \
    --azure-file-volume-account-name cs217dfd5a81083x41faxb08 \
    --azure-file-volume-account-key  XXXXXXXXXXXXXXXXXXXXXXXX \
    --azure-file-volume-share-name mlstorage \
    --azure-file-volume-mount-path /app/data_automl 

容器正在运行,但是当我进行API调用时没有得到响应。

运行后:

az container logs --name automl \
                     --resource-group mlcontainers2 

这在日志中显示:

 * Serving Flask app "server" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
2019-09-18 08:10:22 wk-caas-a254ed947c89463fb2838437151e02a3-e0eb3a654e2770b95a94bb werkzeug[8] INFO  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
2019-09-18 08:11:15 wk-caas-a254ed947c89463fb2838437151e02a3-e0eb3a654e2770b95a94bb werkzeug[8] INFO 10.240.255.55 - - [18/Sep/2019 08:11:15] "POST /api/AutoML HTTP/1.1" 404 -

最后一行:

werkzeug[8] INFO 10.240.255.55 - - [18/Sep/2019 08:11:15] "POST /api/AutoML HTTP/1.1" 404

是我进行API调用后得到的响应。

编辑:

在容器上,我正在运行Flask应用程序以通过API访问模型:

headers = {'content-type': 'application/json'}
url = "http://52.241.XXX.XXX:5000/api/AutoML"
resp = requests.post(url,data=json.dumps(data), headers=headers ) 

edit2 我尝试将docker文件中的5100更改为5000,我从API调用中得到了他的错误:

ConnectionError: HTTPConnectionPool(host='52.241.132.234', port=5000): Max retries exceeded with url: /api/AutoML (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb8ba726320>: Failed to establish a new connection: [Errno 110] Connection timed out')

编辑3

我尝试了一个没有装载卷的容器,但得到了完全相同的错误:

2019-09-18 18:07:11 wk-caas-4301d2868e144ac59af68a0ad87e4442-726fc0246008fe50938461 werkzeug[8] INFO 10.240.255.55 - - [18/Sep/2019 18:07:11] "POST /api/AutoML HTTP/1.1" 404 

因此,我认为错误是未正确安装卷。

编辑4:

图像在本地运行良好,并且通过API以相同的方式调用,除了我使用localhost而不是实例的IP。我已经根据可用端口对5000和5100端口进行了测试。默认情况下,我使用端口5000,因为它也是flask的默认端口。

headers = {'content-type': 'application/json'}
url = "http://localhost:5000/api/AutoML"
resp = requests.post(url,data=json.dumps(data), headers=headers ) 

1 个答案:

答案 0 :(得分:0)

要使用自定义映像创建Azure容器实例,首先,需要确保该映像在本地可以正常运行。当图像正常时,您可以使用该图像创建ACI并公开正确的端口。

更新

在此问题中,问题在于命令中的安装路径应为/app/data_automl/

相关问题