docker上的Jenkins无法运行生成脚本
我正在使用jenkins图像在docker容器上运行。我有一个图像的修改版本,如下所示:docker上的Jenkins无法运行生成脚本,docker,jenkins,Docker,Jenkins,我正在使用jenkins图像在docker容器上运行。我有一个图像的修改版本,如下所示: USER root RUN apt-get update RUN apt-get install -y sudo RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - RUN apt-get install -y nodejs RUN npm -v USER jenkins 当我运行基于此图像的容器时,一切都很顺利。我可以进入
USER root
RUN apt-get update
RUN apt-get install -y sudo
RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
RUN apt-get install -y nodejs
RUN npm -v
USER jenkins
当我运行基于此图像的容器时,一切都很顺利。我可以进入容器,做npm-v,一切都很好。然而,我的jenkins上的构建脚本
echo 'starting build'
npm -v
失败,错误为未找到npm npm不在jenkins用户的路径中 您可以在容器上获得一个外壳,以确定npm路径:
docker exec -it <CONTAINER_NAME> bash
which npm
docker exec-it bash
哪个npm
然后,您可以在jenkins脚本中使用完整路径运行它,对其进行符号链接,将其添加到$path等