Hi I'm making an Azure IOT edge Gateway and I’m trying to install à custom module on it but I have this error:
Error calling Create module serverModule: Could not create module serverModule caused by: No such image: MyDockerAzureContainerServer/serverModule:0.0.1-amd64) ....
but if I run
docker pull MyDockerAzureContainerServer/serverModule:0.0.1-amd64
it works!
BTW : I’m working on a winndows10 device running docker Linux containers
I really don’t get it thanks for any help.
deployment.json :
{
"$schema-template": "2.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.0",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {
"Server Name": {
"username": "$CONTAINER_REGISTRY_USERNAME_user",
"password": "$CONTAINER_REGISTRY_PASSWORD_userPW",
"address": "server Name.azurecr.io"
}
}
}
},
"systemModules": {
"edgeAgent": {
"type": "docker",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.0",
"createOptions": {}
}
},
"edgeHub": {
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.0",
"createOptions": {
"HostConfig": {
"PortBindings": {
"5671/tcp": [
{
"HostPort": "5671"
}
],
"8883/tcp": [
{
"HostPort": "8883"
}
],
"443/tcp": [
{
"HostPort": "443"
}
]
}
}
}
}
}
},
"modules": {
"serverModule": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.serverModule}",
"createOptions": {}
}
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.0",
"routes": {
"serverModuleToIoTHub": "FROM /messages/modules/serverModule/outputs/* INTO $upstream"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}
(English is not my native language sorry)
I finally manage to run it :
I configured my docker to run windows containers and I created a dockerfile.windows-amd64 on witch I run basic npm installations commands for windows.
Dockerfile.windows-amd64 :
FROM stefanscherer/node-windows:latest
RUN mkdir \app
WORKDIR /app
ONBUILD COPY package.json package.json
ONBUILD RUN npm install
ONBUILD RUN npm install {anny other specific dependencies} --production
ONBUILD COPY . .
CMD [ "node.cmd", "app.js" ]
once you have done that you need to add this file un the known platforms, to do so modify the module.json file of your projet and add the windows-amd64 line :
{
"$schema-version": "0.0.1",
"description": "",
"image": {
"repository": "{you're Server Name}.azurecr.io/{you're Module}",
"tag": {
"version": "0.0.1",
"platforms": {
"amd64": "./Dockerfile.amd64",
"amd64.debug": "./Dockerfile.amd64.debug",
"arm32v7": "./Dockerfile.arm32v7",
"arm32v7.debug": "./Dockerfile.arm32v7.debug",
"Windows-amd64": "./Dockerfile.windows-amd64"
}
},
"buildOptions": []
},
"language": "javascript"
}
and finally you need to modify this line in the deployment.template.json :
[...]
"modules": {
"{you're Module}": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.{you're Module}.Windows-amd64}",
"createOptions": {}
}
}
}
[...]
And it should run fine.
Note that I Run now a NodeJS app on a Windows container on a Windows machine running docker Windows.
I leave this answer if it can help anyone feel free to contact me of you have any questions.