{"id":838,"date":"2023-08-13T22:43:48","date_gmt":"2023-08-13T17:13:48","guid":{"rendered":"https:\/\/www.openwriteup.com\/?page_id=838"},"modified":"2023-08-13T22:43:48","modified_gmt":"2023-08-13T17:13:48","slug":"docker-registry","status":"publish","type":"page","link":"https:\/\/www.openwriteup.com\/?page_id=838","title":{"rendered":"Docker Registry"},"content":{"rendered":"<p>This session we will push the image to docker registry<\/p>\n<p>Lab1 : Push an image to docker registry<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Login to hub.docker.com and\u00a0 select the free account [verify account, if you have just signed up]<\/strong><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>From command line do the docker login<\/p>\n<pre>docker login<\/pre>\n<p><a href=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/login.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-840\" src=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/login-300x57.jpg\" alt=\"\" width=\"300\" height=\"57\" srcset=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/login-300x57.jpg 300w, https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/login-700x133.jpg 700w, https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/login.jpg 715w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<pre>docker image tag myimage amitow\/myimage<\/pre>\n<p>amitow:\u00a0 Name of the docker registry name space<\/p>\n<p>myimage: ImageName<\/p>\n<p>Note: If no tag provided, this would be latest tag.<\/p>\n<pre>docker image push amitow\/myimage<\/pre>\n<p><a href=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/push.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-841\" src=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/push-300x83.jpg\" alt=\"\" width=\"300\" height=\"83\" srcset=\"https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/push-300x83.jpg 300w, https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/push-700x194.jpg 700w, https:\/\/www.openwriteup.com\/wp-content\/uploads\/2023\/08\/push.jpg 731w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Lab2: Create a Private Registry and Push Docker Image<\/strong><\/p>\n<p>To create a private Docker registry and push an image, follow these steps:<\/p>\n<ol>\n<li>Install Docker Registry on a server or a cloud-based platform of your choice. You can use a Docker image to do this. For example:<\/li>\n<\/ol>\n<pre>docker run -d -p 5000:5000 --restart=always --name registry registry:2<\/pre>\n<p>This will start a Docker Registry container listening on port 5000.<\/p>\n<ol start=\"2\">\n<li>Build your Docker image, and tag it with the address of your private registry:<\/li>\n<\/ol>\n<pre>docker tag myimage localhost:5000\/my-image<\/pre>\n<ol start=\"3\">\n<li>Push the image to your private registry:<\/li>\n<\/ol>\n<pre>docker push localhost:5000\/my-image<\/pre>\n<p>4. Verify that the image is in the registry by running:<\/p>\n<pre>curl <a href=\"http:\/\/localhost:5000\/v2\/_catalog\">http:\/\/localhost:5000\/v2\/_catalog<\/a><\/pre>\n<p>This should return a JSON object containing the name of your image.<\/p>\n<p>5. Pull the image from your private registry:<\/p>\n<pre>docker pull localhost:5000\/my-image<\/pre>\n<p>You can now use this image on any Docker host that has access to your private registry.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This session we will push the image to docker registry Lab1 : Push an image to docker registry Login to hub.docker.com and\u00a0 select the free account [verify account, if you have just signed up] &nbsp; From command line do the docker login docker login docker image tag myimage amitow\/myimage amitow:\u00a0 Name of the docker registry [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_oct_exclude_from_cache":false,"footnotes":""},"class_list":["post-838","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=838"}],"version-history":[{"count":1,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/838\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=\/wp\/v2\/pages\/838\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/www.openwriteup.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}