Bruno Arine

Docker error while deploying an Azure ML endpoint locally

I’ve recently had to debug an attempt of deploying an Azure ML online endpoint. Unsurprisingly, Azure tends to spit out quite uninformative error messages when something breaks, so my best bet at tackling it was deploying my machine learning model locally, as suggested by Azure itself.

Following Azure’s instructions, here’s how to deploy an endpoint locally using Azure CLI tools:

az ml online-deployment create --endpoint-name <endpoint-name> -n <deployment-name> -f <spec_file.yaml> --local

However, I got the following error when running the command above on MacOS:

Unexpected error verifying an endpoint with the provided name doesn't exist
                        Full error can be found here:
                        Please make sure Docker Engine is installed and running. https://docs.docker.com/engine/install/

I ran the same command again, but adding the --debug flag at the end, and found the culprit:

  File "/Users/bruno.arine/.azure/cliextensions/ml/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

So that was the issue. I’m using colima to manage my containers on MacOS, and apparently, Azure’s script is trying to connect to Docker but just can’t find it. I solved the issue by first finding out which Docker endpoint Azure CLI should use, running docker context ls. This is what that command gave me:

NAME            DESCRIPTION                             DOCKER ENDPOINT
colima *        colima                                  unix:///Users/bruno.arine/.colima/default/docker.sock
default         Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux                                           unix:///Users/bruno.arine.docker/run/docker.sock

By specifying which endpoint to use, Azure CLI started to work as expected:

DOCKER_HOST=unix:///Users/bruno.arine/.colima/default/docker.sock az ml online-endpoint create --local -f path_to_file.yaml

Try the command above in the terminal. If it succeeds, you’ll get a JSON response.