mbdotnet
mbdotnet

Reputation: 1

Docker - Volumes inside volumes?

I try to start the Docker Jenkins Container (jenkins/jenkins:2.218-jdk11) so that if you create a new Jenkins Container you have all plugins already installed and skip the installation.

For this I have a preinstalled /var/jenkins_home (where all the data from Jenkins is located) that Docker uses to start, which works. This home directory doesn't need to be persistent and is only needed for the first startup so it can be copied into the container.

Inside /var/jenkins_home there are 2 directories which must be persistent. I have already tried with my own docker file to overwrite /var/jenkins_home with my own version which didn't work (maybe wrong configuration?). Do you have any tips how I could implement such a concept?

Upvotes: 0

Views: 63

Answers (1)

Rafik Saad
Rafik Saad

Reputation: 646

Hello you can mount volumes for the directories you want to persist.

$ docker run -v /path/to/persistence:/var/jenkins_home/dir_persisted jenkins-image:2.218

Upvotes: 1

Related Questions