Jenkins Docker container with root permissions?

Sidharth picture Sidharth · Nov 9, 2016 · Viewed 18.5k times · Source

I want to build a jenkins docker container with root permissions so that i can us apt-get feature to install gradle.

I am using this command to run jenkins on 8080 port but i also want to add gradle as enviornment variable :

docker run -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home jenkins

or what dockerfile i need to create and what to write in it so that jenkins also start running at 8080

Answer

Sidharth picture Sidharth · Nov 10, 2016

I am now able to login into my docker container as root and apt-get can be used to install gradle or anything manually into the container.

Command i used to enter as root in container :

docker exec -u 0 -it mycontainer bash