I'm a bit lost: are you trying to use Jenkins, or develop a plugin? Can you please clarify your use case?
Thanks Le jeu. 21 mars 2019 à 21:06, Parichay Barpanda <[email protected]> a écrit : > In my case if I am not running the Jenkins in a docker but on my local > machine where I have docker installed under root user. > > So for creating the agent, docker command needs to run with sudo > priviledge but as you suggest I shouldn't give that priviledge to Jenkins > agent. > > Now I have 2 options: > > 1) Either run a Jenkins instance as a docker container > > 2) Or Install docker for my user in my local machine > > If you think there is a better way then I would like to know. Thanks for > the help, I would see next time that appropriate topics are posted in the > appropriate group. > > On Friday, March 22, 2019 at 1:20:24 AM UTC+5:30, Mark Waite wrote: >> >> This is a good question for the users list rather than the developers >> list. The developers list is generally used for topics related to the >> development of Jenkins and the plugins which run on Jenkins. Your question >> is more about using Jenkins than developing something that will extend or >> enhance Jenkins. >> >> In general, you don't want to run a Jenkinsfile as root. That's granting >> far more permission to the Jenkinsfile than should be granted and places >> the machine at risk of damage from innocent user mistakes. It is less >> dangerous to allow the agent user to run docker than to allow the agent >> user to use sudo to become root. >> >> On Thu, Mar 21, 2019 at 1:45 PM Parichay Barpanda <[email protected]> >> wrote: >> >>> I am running a plugin on my local machine with this command: >>> >>> mvn hpi:run >>> >>> My repository contains a Jenkinsfile which runs a docker image to build >>> a latex document. >>> >>> Jenkinsfile looks like: >>> >>> pipeline { >>> agent none >>> stages { >>> stage('Build') { >>> agent { >>> docker { >>> image 'blang/latex:ubuntu' >>> } >>> } >>> steps { >>> sh 'xelatex sample.tex' >>> } >>> } >>> } >>> } >>> >>> Since the Jenkins instance is running on my local machine and in my >>> local machine docker is installed for the root user only so I need a way to >>> execute the Jenkinsfile with sudo permission. >>> >>> I recieve an error like this: >>> >>> + docker pull blang/latex:ubuntu >>> Got permission denied while trying to connect to the Docker daemon >>> socket at unix:///var/run/docker.sock: Post >>> http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/create?fromImage=blang%2Flatex&tag=ubuntu: >>> dial unix /var/run/docker.sock: connect: permission denied >>> script returned exit code 1 >>> >>> Can anyone suggest a way how I can run docker with root permission >>> inside the Jenkins pipeline? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jenkinsci-dev/b0106f8f-fa09-4dc7-98a3-f7bdff9f0d6f%40googlegroups.com >>> <https://groups.google.com/d/msgid/jenkinsci-dev/b0106f8f-fa09-4dc7-98a3-f7bdff9f0d6f%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> Thanks! >> Mark Waite >> > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/ec67a488-f926-4e59-954c-6339d7cc59e1%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-dev/ec67a488-f926-4e59-954c-6339d7cc59e1%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS7sMnz3s%3DmWWvtwNUtCdjq4YgPB6R21AobfC7o6x9HzhA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
