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.jsonfile on your Docker host machine. - Add the following lines to the file, replacing
your-registrywith the URL of your private registry andyour-usernameandyour-passwordwith 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 infocommand. 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 Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals
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?