VOOZH about

URL: https://thenewstack.io/tutorial-install-the-docker-harbor-registry-server-on-ubuntu-18-04/

⇱ Tutorial: Install the Docker Harbor Registry Server on Ubuntu 18.04 - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2019-07-16 12:00:37
Tutorial: Install the Docker Harbor Registry Server on Ubuntu 18.04
tutorial,
Containers

Tutorial: Install the Docker Harbor Registry Server on Ubuntu 18.04

Jul 16th, 2019 12:00pm by Jack Wallen
👁 Featued image for: Tutorial: Install the Docker Harbor Registry Server on Ubuntu 18.04
Feature image by len_lov from Pixabay.

If you and your company are looking for an on-premises Docker image registry, you cannot go wrong with Harbor. With Harbor you not only get a solid solution for housing your images, you gain the ability (along with the addition of the Clair) of scanning your images for vulnerabilities. Given how more and more Docker images are being found with issues, having the ability to scan them, before they are used for the deployment of containers, can be a real boon to any company looking to up their container security.

The key features of Harbor include:

  • Security and vulnerability analysis
  • Content signing and validation
  • Extensible API and web UI
  • Image replication
  • Role-based access control
  • Multitenant

Let’s get Harbor up and running.

What You’ll Need

Here’s what you’ll need for a successful Harbor installation:

  • A running instance of Ubuntu Server 18.04.
  • A user account with sudo privileges.

Docker and Docker Compose

Before we actually install Harbor, there are a number of dependencies to take care of. Let’s get everything ready.

The first tool to install is Docker itself. Open a terminal window and issue the command:

sudo apt-get install docker.io

Once Docker is installed, you need to add your user to the docker group with the command:

sudo usermod -aG docker $USER

Log out and log back in (so the changes will take effect).

Next, we need to install the docker-compose command. As this cannot be installed via the standard repositories, it is taken care of with the following commands:

sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

NGINX

The next dependency to install is NGINX. If your instance of Ubuntu Server 18.04 already has Apache installed, it will interfere with the installation of NGINX. To get around this, stop and disable it with the following commands:

sudo systemctl stop apache2

sudo systemctl disable apache2

With Apache out of the way, install NGINX with the command:

sudo apt-get install nginx

Start and enable NGINX with the commands:

sudo systemctl start nginx
sudo systemctl enable nginx

Download and Install Harbor

With the dependencies taken care of, it’s time to install Harbor. Download the Harbor offline installer with the command:

wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.1.tgz

NOTE: Make sure to visit the Harbor release page to check for the latest version.

Unpack the downloaded Harbor file with the command:

tar xvzf harbor-offline-installer-v1.8.1.tgz

The above command will create a new directory, named harbor. Change into that directory with the command:

cd harbor

Creating SSL Keys

Harbor cannot function properly without SSL. Because of this, you need to add SSL keys. If this is a production environment, you should purchase keys from a reputable CA. Since this is a test case, we’ll create self-signed keys.

NOTE: I’ll be demonstrating with the IP address 192.168.1.203. Make sure to substitute the IP address of your Harbor server in the commands and configurations below.

Since we are going the self-signed route, we need to modify the /etc/ssl/openssl.cnf file. Open that file for editing with the command:

sudo nano /etc/ssl/openssl.cnf

Locate the [v3_ca] section in that file and add the following line (Figure A):

subjectAltName = IP:192.168.1.203

👁 Image

Figure A: The necessary openssl.cnf modification.

Generate the self-signed certificates with the command:

openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 3650 -out ca.crt

Make sure to answer the questions (using the IP address or domain of your Harbor server for the Common Name). Next, generate the signing request with the command:

openssl req -newkey rsa:4096 -nodes -sha256 -keyout 192.168.1.203 -out 192.168.1.203

Again, answer the necessary questions.

Create a configuration file for the Subject Alternate name with the command:

nano extfile.cnf

In that file, paste the following:

subjectAltName = IP:192.168.1.203

Save and close the file.

Generate the certificate with the command:

openssl x509 -req -days 3650 -in 192.168.1.203 -CA ca.crt -CAkey ca.key -CAcreateserial -extfile extfile.cnf -out 192.168.1.203

With the key generation complete, we need to copy the newly-generated certificates into the proper directory. First, create the directory with the command:

sudo mkdir -p /etc/docker/certs.d/192.168.1.203

Now copy the keys with the command:

sudo cp *.crt *.key /etc/docker/certs.d/192.168.1.203

Configuring the Harbor Installer

Before running the installation command, a few edits must be made to the harbor.yml file. Open that file for editing with the command:

nano harbor.yml

The following options must be edited:

  • hostname — set this to either the IP address or the domain of your hosting server.
  • port — set this to 8080.
  • harbor_admin_password — set this to a strong, unique password.
  • password (in the database configuration section) — change this to a strong, unique password.

Because we are using SSL, it is also necessary to uncomment (remove the leading # characters) the following lines:

https:
port: 443
certificate: /etc/ssl/certs/ca.crt
private_key: /etc/ssl/certs/ca.key

Make sure to edit the paths of the keys to reflect:

certificate: /etc/docker/certs.d/192.168.1.75/ca.crt
private_key: /etc/docker/certs.d/192.168.1.75/ca.key

The SSL section should look similar to that shown in Figure B.

👁 Image

Figure B: The SSL section of the harbor.yml file.

Save and close that file.

Installing Harbor

It’s time to install Harbor. We’ll be installing the service with Clair support (for the scanning of vulnerabilities). To do this, issue the command:

sudo ./install.sh --with-clair

The installation takes a bit of time, so be patient until the harbor services are started (Figure C) and you are returned your bash prompt.

👁 Image

Figure C: The Harbor installation is almost complete.

The installation should complete without errors. When it does, open a browser and point it to https://SERVER_IP/harbor (Where SERVER_IP is the IP address or domain of your Harbor server). You will be prompted for the admin user credentials (username is admin and password is the password you set in the harbor.yml file).

Once you’ve successfully logged in, you are ready to start using Harbor as your on-premises Docker registry.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.