<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Docker Hub Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/docker-hub/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/docker-hub/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Thu, 27 Apr 2023 09:10:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>Docker Hub Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/docker-hub/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Host Your Own Docker Hub in ServerStadium</title>
		<link>https://serverstadium.com/knowledge-base/how-to-host-your-own-docker-hub-in-serverstadium/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 07 Jan 2021 07:03:02 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=617</guid>

					<description><![CDATA[<p>Docker is a popular container application to host an application on a container instead of a server. Docker has a free public registry named Docker Hub that can host custom Docker images. But, there is a condition that a developer does not want his Docker image publicly available. And the Docker Registry exists to meet&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-host-your-own-docker-hub-in-serverstadium/">How to Host Your Own Docker Hub in ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Docker is a popular container application to host an application on a container instead of a server. Docker has a free public registry named <strong>Docker Hub</strong> that can host custom Docker images.</p>



<p class="wp-block-paragraph">But, there is a condition that a developer does not want his Docker image publicly available. And the <strong>Docker Registry </strong>exists to meet that condition. Docker Registry is an application that manages, stores, and delivers container images in a private environment.</p>



<p class="wp-block-paragraph">Here are the steps to host the Docker Registry environment or hub in ServerStadium using <a href="https://serverstadium.com/knowledge-base/securing-ubuntu-with-ufw/" target="_blank" rel="noreferrer noopener">Ubuntu</a> Virtual Machine.</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Prerequisites</h3>



<ul class="wp-block-list">
<li>Two Ubuntu VM&#8217;s acted as private Docker Registry server and the other as a client. In this tutorial, there are 2 VM&#8217;s :<br /><strong>Docker Registry &#8211; 198.167.141.168 &#8211; dockerhub1</strong><br /><strong>Client &#8211; 202.43.249.219 &#8211; dockerhub2</strong></li>
<li>Docker and Docker-Compose installed on both VM&#8217;s.</li>
</ul>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 1 &#8211; Installing and Configuring the Docker Registry</h3>



<p class="wp-block-paragraph">To begin with is make a container that contains Docker Registry application running on Docker Registry server with port <strong><span class="has-inline-color has-vivid-cyan-blue-color">5000</span></strong> (this is optional), with the command :</p>



<pre class="wp-block-code"><code># docker run -d -p 5000:5000 --restart=always --name registry registry:2</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="639" height="39" class="wp-image-632" src="https://serverstadium.com/wp-content/uploads/2020/12/001.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/001.png 639w, https://serverstadium.com/wp-content/uploads/2020/12/001-300x18.png 300w" sizes="(max-width: 639px) 100vw, 639px" /></figure>



<p class="wp-block-paragraph">Then, pull an image from Docker Hub, for example, like <strong><span class="has-inline-color has-vivid-cyan-blue-color">Alpine</span></strong> image like the below :</p>



<pre class="wp-block-code"><code># docker pull alpine:latest</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="332" height="32" class="wp-image-633" src="https://serverstadium.com/wp-content/uploads/2020/12/002.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/002.png 332w, https://serverstadium.com/wp-content/uploads/2020/12/002-300x29.png 300w" sizes="(max-width: 332px) 100vw, 332px" /></figure>



<p class="wp-block-paragraph">If the pulling process is successful you will get output like the below :</p>



<pre class="wp-block-code"><code>REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
alpine        latest    389fef711851   10 days ago     5.58MB</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="439" height="80" class="wp-image-651" src="https://serverstadium.com/wp-content/uploads/2020/12/003-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/003-1.png 439w, https://serverstadium.com/wp-content/uploads/2020/12/003-1-300x55.png 300w" sizes="(max-width: 439px) 100vw, 439px" /></figure>



<p class="wp-block-paragraph">Give a new tag into that Alpine image based on Docker Registry location, in this case, is <strong><span class="has-inline-color has-vivid-cyan-blue-color">localhost</span></strong>, with the command :</p>



<pre class="wp-block-code"><code># docker tag alpine:latest localhost:5000/alpine:latest</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-636" src="https://serverstadium.com/wp-content/uploads/2020/12/004.png" alt="" /></figure>



<p class="wp-block-paragraph">If you are running the &#8220;<strong>docker images</strong>&#8221; once again, you will get a result like this :</p>



<pre class="wp-block-code"><code>REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
localhost:5000/alpine   latest    389fef711851   10 days ago     5.58MB</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="509" height="94" class="wp-image-637" src="https://serverstadium.com/wp-content/uploads/2020/12/005.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/005.png 509w, https://serverstadium.com/wp-content/uploads/2020/12/005-300x55.png 300w" sizes="(max-width: 509px) 100vw, 509px" /></figure>



<p class="wp-block-paragraph">After that, push that custom image into Docker Local Registry, with the command :</p>



<pre class="wp-block-code"><code># docker push localhost:5000/alpine:latest</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="433" height="36" class="wp-image-638" src="https://serverstadium.com/wp-content/uploads/2020/12/006.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/006.png 433w, https://serverstadium.com/wp-content/uploads/2020/12/006-300x25.png 300w" sizes="(max-width: 433px) 100vw, 433px" /></figure>



<p class="wp-block-paragraph">If successful, those custom Docker Images will be saved into your own made Docker Registry server.</p>



<pre class="wp-block-code"><code>The push refers to repository [localhost:5000/alpine]
777b2c648970: Pushed 
latest: digest: sha256:074d3636ebda6dd446d0d00304c4454f468237fdacf08fb0eeac90bdbfa1bac7 size: 528</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="687" height="65" class="wp-image-639" src="https://serverstadium.com/wp-content/uploads/2020/12/007.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/007.png 687w, https://serverstadium.com/wp-content/uploads/2020/12/007-300x28.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></figure>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 2 &#8211; Pulling Images from the Docker Registry Server</h3>



<p class="wp-block-paragraph">Move the environment into the client VM. And then continues the steps by pulling the custom image from the Docker Registry server, with the command :</p>



<pre class="wp-block-code"><code># docker pull 198.167.141.168:5000/alpine:latest</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="473" height="32" class="wp-image-640" src="https://serverstadium.com/wp-content/uploads/2020/12/008.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/008.png 473w, https://serverstadium.com/wp-content/uploads/2020/12/008-300x20.png 300w" sizes="(max-width: 473px) 100vw, 473px" /></figure>



<p class="wp-block-paragraph">You will be getting an error response like this :</p>



<pre class="wp-block-code"><code>Error response from daemon: Get https://198.167.141.168:5000/v2/: http: server gave HTTP response to HTTPS client</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="797" height="36" class="wp-image-641" src="https://serverstadium.com/wp-content/uploads/2020/12/009.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/009.png 797w, https://serverstadium.com/wp-content/uploads/2020/12/009-300x14.png 300w, https://serverstadium.com/wp-content/uploads/2020/12/009-768x35.png 768w" sizes="(max-width: 797px) 100vw, 797px" /></figure>



<p class="wp-block-paragraph">That error response is caused by Docker default configuration only allowing pull process using a <span class="has-inline-color has-vivid-red-color">secure connection (HTTPS)</span>. Because the Docker Registry service that setup on the Docker Registry server <span class="has-inline-color has-vivid-cyan-blue-color">(VM 198.167.141.168)</span> only uses an <span class="has-inline-color has-vivid-cyan-blue-color">HTTP connection</span>, it will make the pull process into that server fail.</p>



<p class="wp-block-paragraph">So, to do the pull process from the Docker Registry server using an HTTP connection, we have to add the <strong>/etc/docker/daemon.json</strong> file with content like the below :</p>



<pre class="wp-block-code"><code>{
   "insecure-registries" : ["198.167.141.168:5000"]
}</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="352" height="32" class="wp-image-643" src="https://serverstadium.com/wp-content/uploads/2020/12/010.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/010.png 352w, https://serverstadium.com/wp-content/uploads/2020/12/010-300x27.png 300w" sizes="(max-width: 352px) 100vw, 352px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="388" height="97" class="wp-image-644" src="https://serverstadium.com/wp-content/uploads/2020/12/011.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/011.png 388w, https://serverstadium.com/wp-content/uploads/2020/12/011-300x75.png 300w" sizes="(max-width: 388px) 100vw, 388px" /></figure>



<p class="wp-block-paragraph">The IP Address section is from the IP Address of the Docker Registry server. Save that file, and then restart the Docker service with the command :</p>



<pre class="wp-block-code"><code># systemctl restart docker.service</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="370" height="19" class="wp-image-645" src="https://serverstadium.com/wp-content/uploads/2020/12/012.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/012.png 370w, https://serverstadium.com/wp-content/uploads/2020/12/012-300x15.png 300w" sizes="(max-width: 370px) 100vw, 370px" /></figure>



<p class="wp-block-paragraph">After that, try the pull process from the Docker Registry server once again. Since the Docker Registry server IP Address is added into <strong>/etc/docker/daemon.json</strong> to use the pull process using an HTTP connection, the result will be succeeded like below :</p>



<pre class="wp-block-code"><code>REPOSITORY                    TAG       IMAGE ID       CREATED         SIZE
198.167.141.168:5000/alpine   latest    389fef711851   10 days ago     5.58MB</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="566" height="94" class="wp-image-646" src="https://serverstadium.com/wp-content/uploads/2020/12/013.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/013.png 566w, https://serverstadium.com/wp-content/uploads/2020/12/013-300x50.png 300w" sizes="(max-width: 566px) 100vw, 566px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="548" height="64" class="wp-image-650" src="https://serverstadium.com/wp-content/uploads/2020/12/014-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/12/014-1.png 548w, https://serverstadium.com/wp-content/uploads/2020/12/014-1-300x35.png 300w" sizes="(max-width: 548px) 100vw, 548px" /></figure>



<p class="wp-block-paragraph">As we can see, the Alpine custom Docker Images are displayed on the docker images list on VM Client <span class="has-inline-color has-vivid-cyan-blue-color">(VM 202.43.249.219),</span> indicating the custom image is successfully pulled from our Docker Registry server.</p>



<p class="wp-block-paragraph">In the future, this Docker Registry server can store and deliver another custom Docker image for multiple application development.</p>



<p class="wp-block-paragraph">Congratulations! You have configured your own Docker Hub (Docker Registry) on ServerStadium Virtual Machine.</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Conclusion</h3>



<p class="wp-block-paragraph">In this guideline, we have installed and configured our own Docker Hub (Docker Registry) on the Virtual Machine ServerStadium environment for serving custom images and containers using Docker Registry as storage and delivering tools to provide custom containers in the application development.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-host-your-own-docker-hub-in-serverstadium/">How to Host Your Own Docker Hub in ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
