<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amir Hossein Kaveh</title>
    <description>The latest articles on DEV Community by Amir Hossein Kaveh (@amirk1998).</description>
    <link>https://dev.to/amirk1998</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F790964%2F910da708-f214-49e9-91bc-49309edb9c87.jpg</url>
      <title>DEV Community: Amir Hossein Kaveh</title>
      <link>https://dev.to/amirk1998</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amirk1998"/>
    <language>en</language>
    <item>
      <title>Docker Private Registry using Harbor</title>
      <dc:creator>Amir Hossein Kaveh</dc:creator>
      <pubDate>Sat, 20 Apr 2024 08:47:09 +0000</pubDate>
      <link>https://dev.to/amirk1998/harbor-private-registry-1ac4</link>
      <guid>https://dev.to/amirk1998/harbor-private-registry-1ac4</guid>
      <description>&lt;h1&gt;
  
  
  01- &lt;strong&gt;Harbor Installation Prerequisites&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Hardware&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The following table lists the minimum and recommended hardware configurations for deploying Harbor.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Resource&lt;/th&gt;
&lt;th&gt;Minimum&lt;/th&gt;
&lt;th&gt;Recommended&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CPU&lt;/td&gt;
&lt;td&gt;2 CPU&lt;/td&gt;
&lt;td&gt;4 CPU&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mem&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;td&gt;8 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disk&lt;/td&gt;
&lt;td&gt;40 GB&lt;/td&gt;
&lt;td&gt;160 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Software&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The following table lists the software versions that must be installed on the target host.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Software&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Docker Engine&lt;/td&gt;
&lt;td&gt;Version 20.10.10-ce+ or higher&lt;/td&gt;
&lt;td&gt;For installation instructions, see &lt;a href="https://docs.docker.com/engine/installation/"&gt;https://docs.docker.com/engine/installation/&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docker Compose&lt;/td&gt;
&lt;td&gt;docker-compose (v1.18.0+) or docker compose v2 (docker-compose-plugin)&lt;/td&gt;
&lt;td&gt;For installation instructions, see &lt;a href="https://docs.docker.com/compose/install/"&gt;https://docs.docker.com/compose/install/&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenSSL&lt;/td&gt;
&lt;td&gt;Latest is preferred&lt;/td&gt;
&lt;td&gt;Used to generate certificate and keys for Harbor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Network ports&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Harbor requires that the following ports be open on the target host.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;443&lt;/td&gt;
&lt;td&gt;HTTPS&lt;/td&gt;
&lt;td&gt;Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4443&lt;/td&gt;
&lt;td&gt;HTTPS&lt;/td&gt;
&lt;td&gt;Connections to the Docker Content Trust service for Harbor. You can change this port in the configuration file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For Opening Network ports , we use &lt;code&gt;ufw&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 22/tcp   &lt;span class="c"&gt;# Open SSH port&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 80/tcp   &lt;span class="c"&gt;# Open HTTP port&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 443/tcp  &lt;span class="c"&gt;# Open HTTPS port&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 4443/tcp &lt;span class="c"&gt;# Open Harbor's default port&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 8080/tcp &lt;span class="c"&gt;# Open port 8080&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we enable the &lt;code&gt;ufw&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw &lt;span class="nb"&gt;enable&lt;/span&gt;     &lt;span class="c"&gt;# Enable ufw&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw status     &lt;span class="c"&gt;# Staus of ufw&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we should an output like following output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Status: active

To Action From
&lt;span class="p"&gt;
---
&lt;/span&gt;
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
4443/tcp ALLOW Anywhere
8080/tcp ALLOW Anywhere
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  02- Configure DNS Records
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Part 1 : DNS Records
&lt;/h2&gt;

&lt;p&gt;We should config and set DNS Records for our domain.&lt;br&gt;
My main domain is : &lt;code&gt;developerhub.blog&lt;/code&gt;&lt;br&gt;
I need a subdomain for Harbor : &lt;code&gt;harbor.developerhub.blog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Also I have IPV4 and IPV6 on my VPS . So we have&lt;/p&gt;


⚠️ Change IPV4 and IPV6 in following tutorial to your VPS IP .



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A Records (IPv4)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@&lt;/code&gt; (or &lt;code&gt;developerhub.blog&lt;/code&gt;): This record maps the root domain to your server's IPv4 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;www.developerhub.blog&lt;/code&gt;: This record maps the &lt;code&gt;www&lt;/code&gt; subdomain to your server's IPv4 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;harbor.developerhub.blog&lt;/code&gt;: This record maps the &lt;code&gt;harbor&lt;/code&gt; subdomain to your server's IPv4 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AAAA Records (IPv6)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@&lt;/code&gt; (or &lt;code&gt;developerhub.blog&lt;/code&gt;): This record maps the root domain to your server's IPv6 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;www.developerhub.blog&lt;/code&gt;: This record maps the &lt;code&gt;www&lt;/code&gt; subdomain to your server's IPv6 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;harbor.developerhub.blog&lt;/code&gt;: This record maps the &lt;code&gt;harbor&lt;/code&gt; subdomain to your server's IPv6 address. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CNAME Record&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;harbor.developerhub.blog&lt;/code&gt;: This record is an alias or a canonical name record that points the &lt;code&gt;harbor&lt;/code&gt; subdomain to another domain name. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MX Record&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@&lt;/code&gt; (or &lt;code&gt;developerhub.blog&lt;/code&gt;): This record specifies the mail server(s) responsible for handling email for your domain. TTL: 86400 (24 hours)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TXT Records&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@&lt;/code&gt; (or &lt;code&gt;developerhub.blog&lt;/code&gt;): TXT records are used for various purposes, such as verifying domain ownership, configuring email security (SPF, DKIM), or providing additional information about your domain. TTL: 3600 (1 hour)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's an example of how your DNS records might look like with TTL values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; A Records (IPv4)
@                   IN A      192.0.2.1      3600
www                 IN A      192.0.2.1      3600
harbor              IN A      192.0.2.1      3600

; AAAA Records (IPv6)
@                   IN AAAA   2001:db8::1    3600
www                 IN AAAA   2001:db8::1    3600
harbor              IN AAAA   2001:db8::1    3600

; CNAME Record (Only if harbor is hosted on a different server)
harbor              IN CNAME  example.com    3600

; MX Record
@                   IN MX 10  mail.example.com 86400

; TXT Records (Examples)
@                   IN TXT    "v=spf1 include:example.com ~all" 3600
@                   IN TXT    "google-site-verification=..." 3600

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The TTL (Time to Live) value specifies the amount of time (in seconds) that a DNS record can be cached by other DNS servers and clients before it needs to be refreshed. A lower TTL value means that changes to your DNS records will propagate faster, but it also increases the load on your DNS server. A higher TTL value reduces the load on your DNS server but may cause delays in propagating changes.&lt;/p&gt;

&lt;p&gt;The recommended TTL values can vary based on your specific use case and requirements. For example, MX records generally have a higher TTL value (e.g., 24 hours) since they don't change frequently, while A and AAAA records may have a lower TTL value (e.g., 1 hour) to facilitate faster updates in case of IP address changes.&lt;/p&gt;

&lt;p&gt;⚠️ We need to configure SSL Certificate for this domain and subdomain . &lt;br&gt;
Also We should set DNS Records for SSL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2 : Let’s Encrypt SSL Certificate
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Installing &lt;code&gt;certbot&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Debian&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Debian-based OS&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;certbot python3-certbot-nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Red-Hat&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#RedHat-based OS&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;certbot python3-certbot-nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Obtain SSL Certificate using &lt;code&gt;Certbot&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot certonly &lt;span class="nt"&gt;--manual&lt;/span&gt; &lt;span class="nt"&gt;--preferred-challenges&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dns &lt;span class="nt"&gt;-d&lt;/span&gt; developerhub.blog &lt;span class="nt"&gt;-d&lt;/span&gt; harbor.developerhub.blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a TXT Record for Domain Ownership Verification&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For &lt;code&gt;developerhub.blog&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;_acme-challenge    TXT    &lt;span class="s2"&gt;"&amp;lt;acme-challenge-value&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;code&gt;harbor.developerhub.blog&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;_acme-challenge.harbor    TXT    &lt;span class="s2"&gt;"&amp;lt;acme-challenge-value&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Warning : The acme-challenge-value for domain and subdomain is different !&lt;/p&gt;

&lt;p&gt;You can check DNS Records and acme-challenge-value in the following website :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://toolbox.googleapps.com/apps/dig"&gt;Dig (DNS lookup)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 - Convert SSL Certificates
&lt;/h2&gt;

&lt;p&gt;If you want to upload you SSL certificate into your domain Provider , it is better to do following steps :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to SSL directory
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/letsencrypt/live/YOURDOMAIN&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/letsencrypt/live/developerhub.blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Convert &lt;code&gt;privkey.pem&lt;/code&gt; to &lt;code&gt;privkey.key&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl pkey &lt;span class="nt"&gt;-in&lt;/span&gt; privkey.pem &lt;span class="nt"&gt;-out&lt;/span&gt; privkey.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Convert &lt;code&gt;cert.pem&lt;/code&gt; to &lt;code&gt;cert.crt&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl x509 &lt;span class="nt"&gt;-in&lt;/span&gt; cert.pem &lt;span class="nt"&gt;-out&lt;/span&gt; cert.crt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Copy &lt;code&gt;cert.crt&lt;/code&gt; to docker directory
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; /etc/docker/certs.d/
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/docker/certs.d/
&lt;span class="c"&gt;# mkdir YOURDOMAIN/&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;developerhub.blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then copy &lt;code&gt;cert.crt&lt;/code&gt; to docker directory :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# cp /etc/letsencrypt/live/YOURDOMAIN/cert.crt /etc/docker/certs.d/YOURDOMAIN&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; /etc/letsencrypt/live/developerhub.blog/cert.crt &lt;span class="se"&gt;\&lt;/span&gt;
/etc/docker/certs.d/developerhub.blog/

&lt;span class="nb"&gt;chmod &lt;/span&gt;644 /etc/docker/certs.d/developerhub.blog/cert.crt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Restart docker
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart docker
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  03- &lt;strong&gt;Harbor Installation Process&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The process of installing Harbor involves several steps, which are all essential to ensure a smooth and successful installation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 - Download the Harbor Installer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first step is to download the Harbor installer from the official GitHub repository. It's important to select the appropriate installer that corresponds to your operating system. This is to ensure compatibility and prevent potential installation issues.&lt;/p&gt;

&lt;p&gt;Harbor Release URL : &lt;a href="https://github.com/goharbor/harbor/releases"&gt;https://github.com/goharbor/harbor/releases&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial , I’ve used &lt;code&gt;offline&lt;/code&gt; installer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
wget &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="sh"&gt;
  https://github.com/goharbor/harbor/releases/download/v2.9.4/&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="sh"&gt;
  harbor-offline-installer-v2.9.4.tgz
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 - Unzip the Installer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once the download process is complete, the next step is to unzip the installer. This can be done using any standard unzipping tool. When unzipped, the installer files should be readily accessible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# tar xzvf harbor-offline-installer-version.tgz&lt;/span&gt;
&lt;span class="nb"&gt;tar &lt;/span&gt;xzvf harbor-offline-installer--v2.9.4.tgz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3 - Configure the &lt;code&gt;harbor.yml&lt;/code&gt; File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, it's time to configure the &lt;code&gt;harbor.yml&lt;/code&gt; file. This configuration file is crucial as it contains various settings and parameters that Harbor will use during and after the installation. It's important to carefully review and update this file according to your specific requirements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./harbor
&lt;span class="nb"&gt;cp &lt;/span&gt;harbor.yml.tmpl harbor.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we should edit the &lt;code&gt;harbor.yml&lt;/code&gt; :&lt;br&gt;
We just edit hostname , http port , https certificate and private_key .&lt;br&gt;
The remain config is default .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Configuration file of Harbor&lt;/span&gt;

&lt;span class="c1"&gt;# The IP address or hostname to access admin UI and registry service.&lt;/span&gt;
&lt;span class="c1"&gt;# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.&lt;/span&gt;
&lt;span class="na"&gt;hostname&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;harbor.developerhub.blog&lt;/span&gt;

&lt;span class="c1"&gt;# http related config&lt;/span&gt;
&lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# port for http, default is 80. If https enabled, this port will redirect to https port&lt;/span&gt;
  &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;

&lt;span class="c1"&gt;# https related config&lt;/span&gt;
&lt;span class="na"&gt;https&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# https port for harbor, default is 443&lt;/span&gt;
  &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;443&lt;/span&gt;
  &lt;span class="c1"&gt;# The path of cert and key files for nginx&lt;/span&gt;
  &lt;span class="na"&gt;certificate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/letsencrypt/live/developerhub.blog/fullchain.pem&lt;/span&gt;
  &lt;span class="na"&gt;private_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/etc/letsencrypt/live/developerhub.blog/privkey.pem&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4 - Run &lt;a href="http://install.sh/"&gt;install.sh&lt;/a&gt; Script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, once the &lt;code&gt;harbor.yml&lt;/code&gt; file has been configured to your liking, the last step is to run the &lt;code&gt;install.sh&lt;/code&gt; script. This script will initiate the installation process of Harbor. You'll need to wait for some time as the script installs all necessary components and sets up Harbor on your system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ After Installation , you can check &lt;code&gt;docker-compose ps&lt;/code&gt; in the harbor directory to ensure harbor images are running and up !&lt;/p&gt;

&lt;h1&gt;
  
  
  04- Harbor UI login
&lt;/h1&gt;

&lt;p&gt;We can login to Harbor UI using the hostname url in &lt;code&gt;harbor.yml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;harbor.developerhub.blog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Credentials for login (Default ) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Username : admin
Password : Harbor12345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  05- Managing Users
&lt;/h1&gt;

&lt;p&gt;From Users Tab , we can add new users to Harbor&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flh8k2ki9erq7uzu7u8bz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flh8k2ki9erq7uzu7u8bz.png" alt="Managing Users in Harbor" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  06- Working with Projects
&lt;/h1&gt;

&lt;p&gt;For creating docker private registry , we need to create new projects to able to push new docker images to Harbor .&lt;br&gt;
So we create a new project name : &lt;code&gt;reg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the client ( Where we want to push images from ) , first we should login to our docker private registry using following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# docker login YOURDOMAIN&lt;/span&gt;
docker login harbor.developerhub.blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then docker asks username and password&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Username : admin
Password : Harbor12345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the credentials is true , you should see this message :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /home/amir/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you are able to push new images to your docker registry !&lt;/p&gt;

&lt;p&gt;For pushing images , you should do following steps :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;list docker images to see the IMAGE ID
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;docker image ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Select the image you want to push and copy the IMAGE ID. Then change the image tag like the following structure
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# docker tag IMAGEID HARBORURL/PROJECT/IMAGE:TAG&lt;/span&gt;
docker tag bb6d28039b8c harbor.developerhub.blog/reg/node:12-alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Then push this docker image
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker push harbor.developerhub.blog/reg/node:12-alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>devops</category>
      <category>docker</category>
      <category>registry</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
