Nicolas S.Xu
Nicolas S.Xu

Reputation: 14554

All job data lost when running Jenkins in Docker and when Jenkins container is stopped

On a VPS server I use the following command to run Jenkins:

docker run -d -p 8080:8080 jenkins

But sometimes, my config error will stop the container, then all my jobs configured in Jenkins are lost.

I follow this video to run Jenkins in Docker. Is this the right way to run Jenkin in Docker? How to save my jobs in my pulled Jenkins image?

Upvotes: 0

Views: 879

Answers (1)

M. Falzone
M. Falzone

Reputation: 103

You have to attach a volume to the container that point to jenkins home directory. Usually I use:

docker run -d -p 80:8080 -v /my-absolute-path/where-is-jenkins_home:/var/jenkins_home jenkins

Upvotes: 3

Related Questions