I'm new to docker, i trying to use jenkins on docker. So I pull jenkins image with this command
docker pull jenkins
Jenkins installed without any error. After that i started jenkins image like the document said. https://hub.docker.com/r/_/jenkins/
docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins
So I tried to login http://localhost:8080/ but I got login error. And its said go to https://wiki.jenkins-ci.org/display/JENKINS/Logging for check. I checked and I need to open /var/log/jenkins/jenkins.log file to generated admin password.
I tried to reach that filed with bash. I didn't get the file.
How can I reach the file ? How to reach my generated password or jenkins files on docker etc.
Thank you.
The password was saved to /var/jenkins_home/secrets/initialAdminPassword.
You can use
docker exec <container> cat /var/jenkins_home/secrets/initialAdminPassword
where <container> is your container id or name.
You can attach volume to jenkins in Yml file then you don't need to look inside container. Just go to your system folder path and check path/folder/secrets/initialAmdinPassword
volumes:
- "path/folder:/var/jenkins_home"
You can see this real example
jenkins:
container_name: jenkins
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
image: jenkins/jenkins
restart: always
volumes:
- "/data/jenkin_vol:/var/jenkins_home"
environment:
- JAVA_OPTS=-Dhudson.footerURL=http://mycompany.com
networks:
- my_network