Azure IOT边缘错误提取自定义NodeJS模块的Docker映像 [英] Azure IOT edge error pulling docker image of custom nodeJS module

查看:64
本文介绍了Azure IOT边缘错误提取自定义NodeJS模块的Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个Azure IOT边缘网关,并尝试在其上安装à自定义模块,但是出现此错误:

Hi I'm making an Azure IOT edge Gateway and I’m trying to install à custom module on it but I have this error:

调用创建模块serverModule时出错:无法创建模块serverModule造成原因:没有此类图片:MyDockerAzureContainerServer/serverModule:0.0.1-amd64)....

Error calling Create module serverModule: Could not create module serverModule caused by: No such image: MyDockerAzureContainerServer/serverModule:0.0.1-amd64) ....

但是如果我跑步

docker pull MyDockerAzureContainerServer/serverModule:0.0.1-amd64

docker pull MyDockerAzureContainerServer/serverModule:0.0.1-amd64

有效!

顺便说一句:我正在使用运行docker Linux容器的winndows10设备

BTW : I’m working on a winndows10 device running docker Linux containers

我真的没有得到任何帮助.

I really don’t get it thanks for any help.

deployment.json:

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)

推荐答案

我终于设法运行它:

我将docker配置为运行Windows容器并创建了一个dockerfile. windows-amd64 在巫婆上,我运行了基本的npm安装命令 windows .

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:

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" ]

完成后,需要在已知平台上添加此文件,为此,请修改projet的module.json文件并添加windows-amd64行:

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"
}

最后,您需要在deployment.template.json中修改此行:

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": {}
         }
     }
 }
[...]

它应该运行正常.

请注意,我现在在运行docker Windows的Windows计算机上的Windows容器上运行NodeJS应用.

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.

这篇关于Azure IOT边缘错误提取自定义NodeJS模块的Docker映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆