Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

When I try to build the below docker file , i get the error "Error response from daemon: Dockerfile parse error line 12: unknown instruction: SUDO"

FROM jenkins
USER root
RUN apt-get -qqy update; apt-get install -qqy sudo
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
RUN wget http://get.docker.com/builds/Linux/x86_64/docker-latest.tgz
RUN tar -xvzf docker-latest.tgz
RUN mv docker/* /usr/bin/
USER jenkins
RUN /usr/local/bin/install-plugins.sh junit git git-client ssh-slaves greenballs chucknorris ws-cleanup
sudo mkdir -p /var/jenkins_home
cd /var/jenkins_home
sudo chown -R 1000 /var/jenkins_home

Add the RUN infront of them if you wants to run them. But the good practice is to mount folder from local to container. If you are tying to map the jenkins home folder, then create /var/jenkins_home folder on local system & then mount to docker container with -v option.

You can follow given link for using docker in dockerized jenkins: https://medium.com/@manav503/how-to-build-docker-images-inside-a-jenkins-container-d59944102f30

This could potentially a separate question , but since you talked about mounting i'm putting this question here. When i ran the following command "sudo docker run -d -p 8080:8080 -p 50000:50000 \-v /private/var/jenkins_home:/var/jenkins_home \-v /var/run/docker.sock:/var/run/docker.sock \--name jenkins \madugula/jen kins" It's giving Error response from daemon: error while creating mount source path '/private/var/jenkins_home': mkdir /private/var/jenkins_home: permission denied. – Venkataramana Madugula Dec 2, 2018 at 15:13 the source directory /private/var/jenkins_home should be exist on local system before creating container. – user2983509 Dec 2, 2018 at 15:23

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.