Storing Passwords in Jenkins—Here’s How I Keep Them Safe and Sound!


First, create a Personal Access Token. How do you create a PAT?
- Follow These Steps:
Log in to DockerHub: https://hub.docker.com/
Go to Account settings:
- Click on Generate New Token:
- Add the following details:
Once you click on Generate, you will see your Docker username and password details encrypted.
Note: We use this method because it is a safe way to log in. Otherwise, you could use the
docker login -u 'username' -p 'password'
command, but it is not recommended due to security concerns.Go to Jenkins Dashboard → Manage Jenkins → Security → Credentials → (global) [Add cred in (global) domain]
- Click on Add Credentials:
- Add required details:
This is how you can store passwords in Jenkins.
Now you can access your image in any docker repository.
- You can also store GitHub credentials in Jenkins in a similar way to DockerHub, allowing you to access any private repository.
I hope you understand the concept of storing password in Jenkins.
Happy Learning! :)
Subscribe to my newsletter
Read articles from Chetan Mohanrao Mohod directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Chetan Mohanrao Mohod
Chetan Mohanrao Mohod
DevOps Engineer focused on automating workflows, optimizing infrastructure, and building scalable efficient solutions.