{"id":876,"date":"2019-09-12T08:11:52","date_gmt":"2019-09-12T08:11:52","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=876"},"modified":"2019-09-12T08:11:52","modified_gmt":"2019-09-12T08:11:52","slug":"docker-creating-a-docker-registry-in-own-hardware","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=876","title":{"rendered":"Docker: Creating a Docker Registry in own hardware"},"content":{"rendered":"<p>DockerHub is a free SaaS platform that can be used for storing and retrieving Docker images in public repositories. DockerHub also provides private registries, which is a paid service. However if we have a good hardware with enough storage and memory, we can also create our own Docker Registry server.<\/p>\n<p><strong>Docker Registry server can be created using the below steps:<\/strong><\/p>\n<p>It is assumed that you know basics of Docker.<\/p>\n<ul>\n<li>In a lab environment, it is good to choose a server hardware with min 2GB RAM and 50GB storage.<br \/>\nInstall CentOS 7 and deploy Docker service<\/li>\n<li>The Docker Registry server can be deployed as a container, by using the image present in DockerHub public cloud registry<\/li>\n<li>As the data\/images stored in the container are not persistent, it is advisable to mount a local storage folder to the container.<\/li>\n<li>Create a folder in the base host which can be attached to the Container that we are going to deploy.<br \/>\n[root@k8s-master ~]# mkdir \/registry\/storage<\/li>\n<li>Now run the following command to deploy the registry server container attaching the local folder to the container and exposing the listening port, 5000 to the public to access.<\/li>\n<li>[root@k8s-master ~]# docker run -d -p 5000:5000 -v \/registry\/storage:\/var\/lib\/registry &#8211;restart=always &#8211;name MyRegistry registry:2<\/li>\n<\/ul>\n<p><strong>Creating and uploading an image to the newly created Docker Registry:<\/strong><\/p>\n<ul>\n<li>Download a Docker image (Example CentOS) from the public repository of DockerHub and run it on the server where our Registry is deployed.<\/li>\n<li>Access the CentOS container, and add some data in the container.<\/li>\n<li>Commit the running container with the changes. Tag the committed container as &#8220;localhost:5000\/myfound&#8221;<\/li>\n<li>Run the following command to upload the image present in the base server to the newly created Registry server<\/li>\n<li>[root@k8s-master ~]# docker push localhost:5000\/myfund<\/li>\n<\/ul>\n<p>Download an image from the newly created Docker Registry to a new server and deploy the image as a container:<\/p>\n<p>WIP &#8230;.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>DockerHub is a free SaaS platform that can be used for storing and retrieving Docker images in public repositories. DockerHub also provides private registries, which <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=876\" title=\"Docker: Creating a Docker Registry in own hardware\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":730,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,25],"tags":[],"class_list":["post-876","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-docker"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=876"}],"version-history":[{"count":1,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/876\/revisions"}],"predecessor-version":[{"id":877,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/876\/revisions\/877"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/730"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=876"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}