Skip to content

Instantly share code, notes, and snippets.

@GiantRobato
Last active April 3, 2019 18:33
Show Gist options
  • Save GiantRobato/1a6bcdef6a5910827008bf71d4469e17 to your computer and use it in GitHub Desktop.
Save GiantRobato/1a6bcdef6a5910827008bf71d4469e17 to your computer and use it in GitHub Desktop.
backup jenkins home when running in docker

Backup Jenkins

If you want to backup your jenkins_home folder, after you start it with docker:

docker run -p 8080:8080 -p 50000:50000 --name jenkins jenkins/jenkins

Backup the jenkins home folder locally via docker <container name>:<folder path> <out_dir>

docker cp jenkins:/var/jenkins_home ./jenkins_home

Now when you re-run jenkins again, reuse this as a persistent volume:

docker run -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 --name jenkins jenkins/jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment