我是Docker的新手。我想用Newman,Jenkins,Jenkins-job-builder创建一个docker容器。请帮我。
我基于官方Jenkins镜像https://hub.docker.com/r/jenkins/jenkins构建了一个docker镜像。
我使用了DockerFile。构建成功,Jenkins应用程序也成功运行。
运行Jenkins之后,我以root身份打开容器docker exec -u 0 -it jenkins bash
并尝试使用jenkins-job-builder添加新作业jenkins-jobs --conf ./jenkins_jobs.ini update ./jobs.yaml
但是我得到了bash: jenkins-jobs: command not found
有我的Dockerfile
FROM jenkins/jenkins
USER root
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get -y install nodejs
RUN npm install -g newman
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python get-pip.py
RUN pip install --user jenkins-job-builder
USER jenkins
最佳答案
构建图像时,您会收到一些警告。特别是这一点很有趣:
WARNING: The script jenkins-jobs is installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
只需从
--user
中删除RUN pip install --user jenkins-job-builder
标志,就可以了。
关于docker - 无法在jenkins docker镜像中添加jenkins-job-builder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57593044/