Install Jenkins Container
How to use this image
This will store the Jenkins data in /your/jenkins/home on your host. Ensure that /your/jenkins/home is accessible by the Jenkins container (jenkins user - uid 1000).
The first time, you must create /your/jenkins/home.
docker run -p 8080:8080 -p 50000:50000 -v /your/jenkins/home:/var/jenkins_home jenkins
Once Jenkins is ready, the output will print a password which you'll need for later.
Backing up data
If you mount Jenkins as a Docker container, you can just back up Jenkins copying the /jenkins_home
folder.
Restoring data
If you need to restore some previous Jenkins configuration, you just need to run this.
docker run -p 8080:8080 -p 50000:50000 -v /your/backup/jenkinshome/folder:/var/jenkins_home jenkins
Configure Admin user
You can access to Jenkins Portal using the specified port on your browser. The first time, you’ll need the secret key, you’ll find it in
/var/Jenkins_home/secrets/initialAdminPassword
With Jenkins unlocked, select the first option “Install suggested plugins”. This will install plugins that will use in the next steps.
Then, set your credentials and then we’re ready to go.
Update Jenkins
You need to remove your actual Jenkins container and Jenkins image. (Keep your /jenkins_home
in the same directory, all jenkins configuration is located there).
Then you need to download the last Jenkins Image.
docker pull jenkins:latest
docker run --name jenkins_container -p 8080:8080 -p 50000:50000 -v /your/jenkins/home:/var/jenkins_home jenkins
Once complete you'll have your jenkins up to date.