Restore Jenkins from Archive
Just so I don't forget, this is how you start Jenkins from an archived JENKINS_HOME
. This is necessary when you need to move the configuration for an existing Jenkins server to a new host.
Usage
- Create an image:
docker build . -t jenkins
- Create and start the container with port 8080 exposed:
docker run -p 8080:8080 jenkins
- Wait for Jenkins to start up.
- Visit
localhost:8080
in your browser.
You should see a login page. This means that Jenkins started from an existing configuration. 🎉
If you want to log in, the username is "admin" and the password is located at /var/new_jenkins_home/secrets/initialAdminPassword
on the container filesystem.
Caveat
This example does not use the default JENKINS_HOME
(/var/jenkins_home
) because it is mounted as a volume in the official Jenkins image, and Docker cannot overwrite a directory on the host. In a real-world scenario, you would shut down Jenkins, replace /var/jenkins_home
on the host with the unzipped archive, and restart Jenkins.