1

I'm having a Jenkins docker container which i had to take a copy of it to push into AWS ECR. So, when I run below command to create an image from running container with existing Jenkins jobs, it started fresh jenkins without any jobs (ie no workspace folder in var/jenkins_home).

docker commit 76df6fa99373 jenkins-dev
docker run --name jenkins-dev -p 8080:8080 -p 50000:50000 jenkins-dev

But I need the old jobs in the new container as well. How can it be achieved? Do I need to copy workspace from old container to new container?

ahkam
  • 607
  • 7
  • 24
  • This isn't really a reproducible setup, and you should almost never use `docker commit`. In this case, the standard Jenkins images are configured so that the configuration and workspace are always stored in volumes, and `docker commit` doesn't save those. The linked question describes a workaround, but a better approach would be to directly set up bind mounts or named volumes for that configuration data so that you can copy it around. (You should set it up so `docker rm` never loses data.) – David Maze Jun 13 '22 at 10:39

0 Answers0