Why jobs and system config were lost when run an image commited from a running jenkins container?

I started a jenkins container from the official jenkins image and added some plugins like git. Also, I made some basic configurations like authentication settings and user registration, then I added a jenkins job and it worked quite well in the running jenkins container.
Question is when I commited this jenkins container as a new version of jenkins image and re-ran the new image, everything was lost: no plugins added, no user registered, no jenkins job created.
Does anyone can help me to make a new jenkins image with all my configurations added? Thank you all.


  • How to run docker daemon?
  • Development environment and local sites URLs best practices
  • Docker run can't run python image- IndentationError: expected an indented block
  • Building & running a mock server's docker container
  • docker: Is it possible to start native windows sibling containers from within another?
  • How to change docker container's source code without restarting it?
  • Connect button disabled in Azure
  • Run nodejs application on subpath with haproxy
  • How to reference the local host inside bash?
  • How to tell docker worker node belong to which swarm?
  • Can't access Docker images when using user namespace
  • How to ship java development env to many workstations
  • 2 Solutions collect form web for “Why jobs and system config were lost when run an image commited from a running jenkins container?”

    you have to backup your data before rerun jenkins image:

    docker cp jenkins-dv:/var/jenkins_home /tmp/jenkins-backup

    also you can check this very helpful tutoriel DOCKER & JENKINS: DATA THAT PERSISTS explain HOST MOUNTED VOLUMES and DATA VOLUME CONTAINERS

    Dockerfile of Jenkins defines a volume for its home directory:

    # Jenkins home directory is a volume, so configuration and build history 
    # can be persisted and survive image upgrades
    VOLUME /var/jenkins_home

    Per default Docker manages this volume on a per container base. If you would like to use same data as in your old image/container version you have mainly two options:

    Give volume a name at run

    docker run -v jenkinshome:/var/jenkins_home jenkins

    or map it to a volume on host system:

    docker run -v /some/dir/jenkinshome:/var/jenkins_home jenkins

    This way data will persist image upgrades. You can read more about managing data at official Docker documentation.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.