Sunday 2 April 2017

finding the docker mount volume location - running jenkins in a container

Finding the Docker mount volume location, running Jenkins in a container


I love running jenkins in a container, no installation locally, and it really is awesome to just spin up a docker container image and run a build process.

I had setup a jenkins container around 5 months ago running on docker and forgot the password and the path to the mounted volume. Here's how you go about getting the volume so you can reset the password

Locate the volume  


I configured my jenkins to use a mounted volume, and had no idea where it was. This is a lazy manner of getting the path - it will be under the mount section:

docker inspect my-jenkins | grep "Source"
Update: this is the proper way to get the mount source:
docker inspect --format='{{range .Mounts}}{{ .Source}}{{end}}'

and locate the folder locally, mine was at
/var/lib/docker/volumes/e6bc1cd088645a4f5b7f69c0ba00951b159b0ccf552cf02bd31c85d64cb35626/_data

Now that I have the mount path I can change the security attribute to false, log in and configure the security again, but at least I am back in.



Docker makes playing with software in images simple; in this way even though I have java installed locally I don't need to spin up and keep jenkins running all the time, just when I want to spin it up.

Cheers
Quintes

Connect with me on LinkedIn or Twitter