OK, after much digging, I found a solution. Whatever you do, don't search online for "create iot module from docker container" or anything COMPLETELY MEANINGFUL like that. Instead, I had to search for something very specific to the Azure Cognitive Service's EULA acceptance on the docker run (i.e. I had to search for "iot edge module docker \"eula\""). Note the quotation marks around eula to ensure it is in the search result. I came across this article.
Using the article's guidance, I will repeat in detail what I did here in case the link ever goes stale.
- In VS Code, create a new IoT Edge Solution
- In your solution, add a new IoT Edge Module
a. When prompted for the type of Module to create, select "Choose Existing Module (Enter Full URL)"
- If you look inside your deployment.template.json file, you will now see a new element for "registryCredentials" that got added to your edgeAgent details. Fill out the address, username, and password accordingly.
- If you haven't done so yet, create your Cognitive Services resource online to obtain an Endpoint URL and an ApiKey. Take note of these values.
In the deployment.template.json file, under your new module's configuration settings, add the following.
"settings": {
"image": "containerpreview.azurecr.io/microsoft/cognitive-services-speech-to-text:latest",
"createOptions":
{
"Cmd": [
"Eula=accept",
"Billing={enter-your-EndpointURL}",
"ApiKey={enter-your-ApiKey}"
],
"HostConfig": {
"PortBindings": {
"5000/tcp": [
{
"HostPort": "5000"
}
]
}
}
}
This will be equivalent to running "docker run" from the command line with parameters like this:
docker run --rm -it -p 5000:5000 --memory 4g --cpus 1 \
containerpreview.azurecr.io/microsoft/cognitive-services-recognize-text \
Eula=accept \
Billing={BILLING_ENDPOINT_URI} \
ApiKey={BILLING_KEY}
- Now "Build and Push your IoT Edge Solution", followed by "Create Deployment for Single Device". On your target IoT Edge device, you should now see the module installed and running via CLI "iotedge list".
Update: 2020/05/01
After submitting a request for better documentation from MSFT, they updated their docs site to include information on how to modify the deployment.template.json file to match the docker command line arguments: https://learn.microsoft.com/en-us/azure/iot-edge/how-to-use-create-options