reiley
reiley

Reputation: 3761

Jenkins location in docker, not at /var/jenkins_home

I'm installing Jenkins via docker by following this official guide.

After running command:

docker run \
  -u root \
  --rm \
  -d \
  -p 8080:8080 \
  -p 50000:50000 \
  -v jenkins-data:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  jenkinsci/blueocean

I'm expecting Jenkins to be installed @ /var/jenkins_home, but instead it is being installed @ /var/lib/docker/volumes/jenkins-data.

Also there is no such folder as /var/jenkins_home.

Am I missing something. Please suggest.

Thank You

Upvotes: 2

Views: 4115

Answers (1)

vivekyad4v
vivekyad4v

Reputation: 14903

/var/jenkins_home is inside the container. You are using named volume & that's why it's located in /var/lib/docker/volumes/jenkins-data.

Instead, you can use host bind mounts as below to ensure you get the data in /var/jenkins_home on the host machine -

docker run \
  -u root \
  --rm \
  -d \
  -p 8080:8080 \
  -p 50000:50000 \
  -v /var/jenkins_home:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  jenkinsci/blueocean

Volumes path in case of host mounts has to be absolute else it results in creating a named volume.

Upvotes: 7

Related Questions