Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find jenkins_home folder in Ubuntu after downloading the Docker Jenkins Image

I pulled Docker-Jenkins image from Docker central repository and run the below command

$ docker run -p 8080:8080 -p 50000:50000 Jenkins

In the middle of the installation, the below lines appeared.

*************************************************************************`
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
xxxxxxxxxxxxxxxxxxxxxx
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
*************************************************************************`

But in my /var, no jenkins_home folder is present.

I am getting the following error and I couldn't access my Jenkins using localhost:8080

INFO: Jenkins is fully up and running
Oct 11, 2016 4:31:19 AM winstone.Logger logInternal
INFO: JVM is terminating. Shutting down Winstone

When the Admin password got generated, I was able to access the Jenkins Dashboard. But immediately, JVM is getting terminated and I can no longer access the Jenkins page.

like image 919
Alla Sasikanth Avatar asked Oct 11 '16 05:10

Alla Sasikanth


1 Answers

After starting jenkins you have 2 choices:

docker run -p 8080:8080 -d -p 50000:50000 jenkins

(The -d option is to run the container in the background) You can go inside the container and checking the initial admin passwd: check running containers

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                              NAMES
cc73eb6d6f75        jenkins             "/bin/tini -- /usr/lo"   32 seconds ago      Up 30 seconds       0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp   ecstatic_leakey

Go inside the container

docker exec -it cc73eb6d6f75 bash

And check the content of the adminpasswd

jenkins@cc73eb6d6f75:/$ cat /var/jenkins_home/secrets/initialAdminPassword
1c8be33b31904cacb5xxx

Or you create your own named docker volume:

[root@localhost ~]# docker volume create --name jenkins-volume
jenkins-volume

This volume is on your host in /var/lib/docker/volumes/jenkins-volume. You can start your jenkins and connect it with the volume:

docker run -p 8080:8080 -d -p 50000:50000 -v jenkins-volume:/var/jenkins_home jenkins

All the data from /var/jenkins_volume inside your container will be mounted inside your named volume. hostpath is: /var/lib/docker/volumes/jenkins-volume/_data

So check on my host:

[root@localhost ~]# ls /var/lib/docker/volumes/jenkins-volume/_data
config.xml               hudson.model.UpdateCenter.xml   init.groovy.d                                jobs              nodes          secret.key                updates      war
copy_reference_file.log  hudson.plugins.git.GitTool.xml  jenkins.install.InstallUtil.lastExecVersion  logs              plugins        secret.key.not-so-secret  userContent  workspace
credentials.xml          identity.key.enc                jenkins.install.UpgradeWizard.state          nodeMonitors.xml  queue.xml.bak  secrets                   users
like image 68
lvthillo Avatar answered Sep 23 '22 02:09

lvthillo