我有以下的Dockerfile:
FROM ubuntu
USER root
RUN apt-get update && apt-get install curl -y
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get update && apt-get upgrade -y && apt-get install nodejs -y
RUN mkdir /opt/public
RUN mkdir /opt/bin
ADD public /opt/public
ADD bin /opt/bin
RUN ls -lah /opt/bin
RUN ls -lah /opt/public
ADD run.sh /bin/run.sh
RUN chmod +x /bin/run.sh
RUN cd /opt/bin && npm install
CMD ["/bin/run.sh"]
当我构建容器时,出现以下错误:
/bin/sh: 1: npm: not found
问题出在哪里?你能帮我解决一下吗?
npm install
改成了apt-get install npm
,但你需要两个命令都执行。 - Yury Fedorovcurl -sL https://deb.nodesource.com/setup_13.x | bash -
。 - fabpico