Suppose that I have a container working!!
Here my Dockerfile...
FROM jenkinsci/blueocean
USER root
RUN apk update && apk add wget
RUN wget --no-verbose -O /tmp/apache-maven-3.6.3-bin.tar.gz https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
RUN tar xzf /tmp/apache-maven-3.6.3-bin.tar.gz -C /opt/
RUN ln -s /opt/apache-maven-3.6.3 /opt/maven
RUN ln -s /opt/maven/bin/mvn /usr/local/bin
RUN rm /tmp/apache-maven-3.6.3-bin.tar.gz
RUN chown jenkins:jenkins /opt/maven;
ENV MAVEN_HOME=/opt/mvn
Now I created the Image...
docker build -t jenkins/blueocean_ci --no-cache .
Now I run my container...
docker run -p 8080:8080 -p 50000:50000 --name jenkinsblue jenkins/blueocean_ci
I made a lot of changes ... plugins installations and pipelines...
ohhh I forget something (whatever to do)
Then I extracted the jenkins directory to d:\Documents\JenkinsBCK\...
docker cp jenkinsblue:/var/jenkins_home d:\Documents\JenkinsBCK\
I would like to persist my changes to previous specific folder location on Windows d:\Documents\JenkinsBCK\, and I will reuse it.
Now, I created another Container using reference to that directory like a Volume, changing ports...
docker run -v d:\Documents\JenkinsBCK:/var/jenkins_home -p 8081:8080 -p 50001:50000 --name jenkins_cnt jenkins/blueocean_ci
Now, I was trying to test my new container with my old stuffs...
http://localhost:8081/
Are you asking for the password again Located in /var/jenkins_home/secrets/initialAdminPassword? hhmmm OK no problem...
docker exec jenkins_cnt bash -c "cat /var/jenkins_home/secrets/initialAdminPassword"
Where are my old configured plugins and pipelines?
What's wrong?
How to do it?