If you are running Jenkins in Docker using the official jenkins/jenkins image you can use sudo docker exec $CONTAINER_ID or CONTAINER_NAME cat /var/jenkins_home/secrets/initialAdminPassword to print the password in the console without having to exec into the container.