简体   繁体   中英

Not found error on azure container with mounted volume

I have deployed a docker container on Azure with the following CLI:

/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 

The container is running but when I make an API call I don't get response.

After running:

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

This is shown in the logs:

 * 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 -

This last line:

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

Is what I get in response after making the API call.

EDIT:

On the container I'm running a Flask app to access my model through an 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 I tried changing 5100 to 5000 in the docker file, I get his error from the API call:

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')

EDIT 3

I tried with a container without the mounted volume I'm getting the exact same error:

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 

Hence, I think the error is that the volume is not been mounted properly.

EDIT 4:

The images work well locally and are called the same way from the API, except that I use localhost instead of the IP of the instance. I have tested with ports 5000 and 5100 depending on which is available. By default, I use port 5000 since is the default port for flask as well.

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

To create the Azure Container Instance with the custom image, first, you need to make sure the image can work well locally. When the image is OK, then you can create the ACI with the image and expose the right port.

Update:

In this issue, the problem is that the mount path in the command should be /app/data_automl/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM