Hi Jon, It worked for me! Thanks for the help. :)
Regards, Parichay (baymac) On Friday, March 22, 2019 at 6:58:06 AM UTC+5:30, Jon Hermansen wrote: > > Parichay, > > It sounds like your user (or more specifically, the user the > Jenkinsfile runs as) does not belong to the docker group. > > > https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user > > > The docker command acts as a client to the docker daemon, and by > default, they communicate using a special socket file, > /var/run/docker.sock -- which is owned by the docker group. To be able > to write to it, you can add your user(s) to the same group. > > On Thu, Mar 21, 2019 at 7:03 PM Parichay Barpanda > <[email protected] <javascript:>> wrote: > > > > Umm.. I'm trying to develop on a plugin(specifically Blue ocean plugin). > To do a dry run, I'm using the command mvn hpi:run. Now when creating a > pipleine with my repository containing the Jenkinsfile as mentioned above, > I'm unable to access the docker command inside the pipeline script because > docker is installed under the root user on my local machine. > > > > To be more clear, on my local machine when I have to run a docker > command, I use a sudo prefix to run it. Like sudo docker run .. I want a > workaround for this problem. > > > > On Fri 22 Mar, 2019, 04:24 Baptiste Mathus <[email protected] > <javascript:> wrote: > >> > >> 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] > <javascript:>> 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. > > > >>>>> 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] <javascript:>. > >>> To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/ec67a488-f926-4e59-954c-6339d7cc59e1%40googlegroups.com. > > > >>> 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] <javascript:>. > >> 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. > > > > -- > > 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] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/CAD0DWAMqNSE8A3F46yhfog%3D%2BMObwjjEHYVXe0CDfA5CmiC8cNg%40mail.gmail.com. > > > > 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/714187b0-17d6-4f43-a66d-54480ab9bb36%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
