Node-Red Build your own Docker image

Build your own Docker image

The docker-custom directory contains files you need to build your own images.

The follow steps describe in short which steps to take to build your own images.

1. git clone

Clone the Node-RED Docker project from github

git clone https://github.com/node-red/node-red-docker.git

Change dir to docker-custom

cd node-red-docker/docker-custom

1. package.json

  • Change the node-red version in package.json (from the docker-custom directory) to the version you require
  • Add optionally packages you require

2. flows.json

  • The flows.json file is the default flow that will be used if no external volume is mounted to /data. You can replace this by a preconfigured flow and launch it by not mounting a /data volume, but most users will mount and save data and flows externally.

3. docker-alpine.sh, docker-debian.sh

The docker-alpine.sh and docker-debian.sh are helper scripts to build a custom Node-RED docker image. The docker-alpine script is based on Alpine as per the default docker package. The docker-debian is based on debian that may be more familiar to users and may support extra customisation more easily.

Change the build arguments as needed:

  • --build-arg ARCH=amd64 : architecture your are building for (arm32v6, arm32v7, arm64v8, amd64)
  • --build-arg NODE_VERSION=14 : NodeJS version you like to use
  • --build-arg NODE_RED_VERSION=${NODE_RED_VERSION} : don't change this, ${NODE_RED_VERSION} gets populated from package.json
  • --build-arg OS=alpine : the linux distro to use (alpine)
  • --build-arg BUILD_DATE="$(date +"%Y-%m-%dT%H:%M:%SZ")" : don't change this
  • --build-arg TAG_SUFFIX=default : to build the default or minimal image (only applies to the alpine build)
  • --file Dockerfile.custom : Dockerfile to use to build your image.
  • --tag testing:node-red-build : set the image name and tag

4. Run docker-alpine.sh or docker-debian.sh

Run docker-alpine.sh or docker-debian.sh

$ ./docker-alpine.sh

This starts building your custom image and might take a while depending on the system you are running on.

When building is done you can run the custom image by the following command:

$ docker run -it -p1880:1880 -v node_red_data:/data --name myNRtest testing:node-red-build

With the following command you can verify your docker image:

$ docker inspect testing:node-red-build

5. Advanced Configuration

The relevant Dockerfile can be modified as required. Examples of how to extend Dockerfiles to add prerequisite libraries can be found here.

問(wèn)題

ssh-keyscan failed, no more retries left
解決方法:
刪除 know_host.sh 中的

ssh-keyscan -p 2022 ${hosts_2022} >> ${known_hosts_file}
256 SHA256:AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434 [source.developers.google.com]:2022 (ECDSA)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容