Jenkins inside docker loses configuration when container is restarted -


i have followed next guide https://hub.docker.com/r/iliyan/jenkins-ci-php/ download docker image jenkins.

when start container using docker start containername command, can access jenkins localhost:8080.

the problem comes when change jenkins configuration , restart jenkins using docker stop containername , docker start containername, jenkins doesn't contain of previous configuration changes..

how can persist jenkins configuration?

you need mount jenkins configuration volume, -v flag you. (you can ignore --privileged flag in example unless plan on building docker images inside jenkins docker image)

docker run --privileged --name='jenkins' -d -p 6999:8080 -p 50000:50000 -v /home/jan/jenkins:/var/jenkins_home jenkins:latest 

the -v flag mount /var/jenkins_home outside container in /home/jan/jenkins maintaining between rebuilds.

--name have fixed name container start / stop from.

then next time want run it, call

docker start jenkins 

Comments