FROM nodered/node-red:latest
USER root
RUN curl -LO https://www.emqx.com/zh/downloads/MQTTX/v1.9.7/mqttx-cli-linux-x64
RUN install ./mqttx-cli-linux-x64 /usr/local/bin/mqttx
USER node-red
使用这样的Dockerfile 生成了自己的镜像
但是node-red里运行mqttx命令是报错:/bin/bash: line 1: /usr/local/bin/mqttx: cannot execute: required file not found
群里有高手给回复了,自己重新安装node-red,可以实现新的docker里可以运行mqttx
FROM node:latest
MAINTAINER zxpstart@126.com
RUN mkdir /usr/src/node-red
WORKDIR /usr/src/node-red
RUN npm install -g --unsafe-perm node-red
RUN wget https://www.emqx.com/zh/downloads/MQTTX/v1.9.7/mqttx-cli-linux-x64 &&
mv mqttx-cli-linux-x64 /usr/bin/mqttx &&
chmod +x /usr/bin/mqttx
EXPOSE 1880
ENTRYPOINT node-red