How can I find initial password for jenkins?

If you have installed Jenkins via docker, then the following command can give you the initial admin password. Assuming your container name/docker image name is jenkins

docker exec `docker ps | grep jenkins | awk '{ print $1}' ` cat /var/jenkins_home/secrets/initialAdminPassword

docker exec <container_name> cat /var/jenkins_home/secrets/initialAdminPassword


If you are using Mac and Docker installation for Jenkins follow bellow steps to get initial administer password to start authentication in Jenkins Console. Type below command in Terminal.

(Note: This is working, if you have follow default steps in Jenkins documentation to install Jenkins in Docker environment)

Find the running containers

: docker ps

Copy the running containerID

: docker exec -it <containerID> bash

: cd /var/jenkins_home/secrets

: cat initialAdminPassword

Use secret password showing in terminal and used as initial password for Jenkins Console.


I tried looking into the container's filesystem, but there's no secrets folder in it. But I found the solution in the jenkins documentation here

Docker outputs the initial secret to the console

To view the console use the command

docker logs <container id of jenkins>

output is somemthing like this: enter image description here

Tags:

Macos

Jenkins