2

I'm new in docker. I want to create a docker container with Newman, Jenkins, Jenkins-job-builder. Please help me.

I built a docker image which bases on official Jenkins image https://hub.docker.com/r/jenkins/jenkins.

I used DockerFile. The build was successful, Jenkins app also runs successfully.

After running Jenkins I opened container as root docker exec -u 0 -it jenkins bash and tryed to add new job with jenkins-job-builder

jenkins-jobs --conf ./jenkins_jobs.ini update ./jobs.yaml

but I got bash: jenkins-jobs: command not found

There is my 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
MaryG
  • 23
  • 3
  • 1
    Hi and welcome to SO. :) What exactly do you mean by "jenkins-jobs command"? AFAIK, there is no such executable like this. What do you want to do from inside the container? Also, your Dockerfile doesn't seem to be complete, as `FROM` is missing, but as you said the build was successful, I guess it was a typo...? – bellackn Aug 21 '19 at 13:46
  • Thank you, I've updated question – MaryG Aug 21 '19 at 15:22

1 Answers1

1

When building your image, you get some warnings. Especially this one is interesting:

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.

Simply remove the --user flag from RUN pip install --user jenkins-job-builder and you're fine.

bellackn
  • 1,939
  • 13
  • 22