These days I'm doing some interesting plugin development for my one of open source project. Unfortunately every time my local machine fails to configure the Jenkins. So I moved to Docker and I try. But it also give some issue when I was creating an image with existing configured docker container. Problem is every docker container relaunch, I have to reconfigure Jenkins again and again.
Finally I found the reason. Data in a Docker volume (such as /var/jenkins_home) is not preserved as part of the docker commit operation. This is intentional -- the idea is that you are persisting you data via some other mechanism, such as a host volume (-v /host/directory:/var/jenkins_home) or through the use of a data container (using --volumes-from).
docker run --name jkins -d -p 8080:8080 jenkins/jenkins
Then I add a volume and mapped with my local folder using following command.
docker run --name jkins -d -v /home/hasitha/apps/jenkins-mount:/var/jenkins_home -p 8080:8080 jenkins/jenkins
Now it work fine. I think this will help you when you try to run Jenkins with Docker. Have a happy coding with Docker and Jenkins.