Method 1 – Change docker config default registry
To change the default registry for Docker to a private registry that requires authentication, you can follow these steps:
- Create or edit the
/etc/docker/daemon.json
file on your Docker host machine. - Add the following lines to the file, replacing
your-registry
with the URL of your private registry andyour-username
andyour-password
with your registry credentials:
{
"auths": {
"your-registry": {
"auth": "your-username:your-password"
}
},
"registry-mirrors": ["https://your-registry"]
}
Note that the auths
key is used to specify the credentials for your private registry, and the registry-mirrors
key is used to specify the URL of the registry.
- Save the file and exit.
- Restart the Docker daemon to apply the changes:
$ sudo systemctl restart docker
- Verify that the configuration has been applied by running the
docker info
command. You should see the URL of your registry listed under “Registry Mirrors”.
$ docker info
...
Registry Mirrors:
https://your-registry/
...
With this configuration, Docker will use your private registry as the default registry for pulling images and will authenticate with your registry credentials.
Method 2 – Create a Secret based on existing credentials using in Pod Spec
- https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
- https://docs.gitlab.com/runner/install/kubernetes.html#using-an-image-from-a-private-registry
Method 3 – Create a Secret based on existing credentials using Helm chart

- https://stackoverflow.com/questions/49669077/helm-chart-deployment-and-private-docker-repository
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND
Good advice!
Your first method (using the daemon.json) is interesting but does not seem to work as docker crashes after a restart. Are you certain that the auths section is correct?