Reputation: 1462
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
Upvotes: 21
Views: 30058
Reputation: 1
docker run --user=root -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home jenkins
Upvotes: 0
Reputation: 1462
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
Upvotes: 63
Reputation: 29109
Building an image that sets USER
to root
will make all interactive logins use root
.
Dockerfile
FROM jenkins/jenkins
USER root
Then (setting your container ID):
docker exec -it jenkins_jenkins_1 bash
root@9e8f16419754:/$
Upvotes: 0