{"id":32892,"date":"2023-02-22T05:27:30","date_gmt":"2023-02-22T05:27:30","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=32892"},"modified":"2025-07-12T05:40:13","modified_gmt":"2025-07-12T05:40:13","slug":"how-to-configure-docker-with-default-private-registry-and-default-login","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-configure-docker-with-default-private-registry-and-default-login\/","title":{"rendered":"How to configure docker with default private registry and default login"},"content":{"rendered":"\n<p>To configure Docker with a default private registry and default login, you will need to follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Set up a private registry: You can set up a private registry on a remote server or locally. You can use a tool like Docker Compose to set up a private registry on a remote server. For example, you can create a <code>docker-compose.yml<\/code> file with the following contents:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\n\nservices:\n  registry:\n    image: registry:2\n    ports:\n      - \"5000:5000\"\n<\/code><\/pre>\n\n\n\n<p>This will start a registry service on port 5000.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Create a configuration file: Create a file called <code>config.json<\/code> with the following contents:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>{\n  \"auths\": {\n    \"your.registry.url\": {\n      \"auth\": \"your_username:your_password\"\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<p>Replace <code>your.registry.url<\/code> with the URL of your private registry, and replace <code>your_username<\/code> and <code>your_password<\/code> with the username and password you want to use to log in to the registry.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Add the configuration file to Docker: You can add the configuration file to Docker by copying it to <code>~\/.docker\/config.json<\/code> on your machine.<\/strong><\/li>\n\n\n\n<li><strong>Test the configuration: You can test the configuration by running the following command:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker login your.registry.url\n<\/code><\/pre>\n\n\n\n<p>Replace <code>your.registry.url<\/code> with the URL of your private registry. If the configuration is correct, you should be able to log in to the registry using the username and password you specified in the configuration file.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Use the private registry: You can now use the private registry as the default registry for Docker. To do this, you can tag your images with the URL of your private registry, and then push the images to the registry. For example:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker tag your-image your.registry.url\/your-image\ndocker push your.registry.url\/your-image\n<\/code><\/pre>\n\n\n\n<p>This will push the <code>your-image<\/code> image to your private registry, and you can now pull the image from the registry using the same URL:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker pull your.registry.url\/your-image<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To configure Docker with a default private registry and default login, you will need to follow these steps: services: registry: image: registry:2 ports: &#8211; &#8220;5000:5000&#8221; This will start a registry&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[],"class_list":["post-32892","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=32892"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32892\/revisions"}],"predecessor-version":[{"id":32893,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32892\/revisions\/32893"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=32892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=32892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=32892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}