Introduction
Harbor is an open-source container image registry that provides enterprise-grade features like role-based access control, vulnerability scanning, and image replication. This tutorial will guide you through the process of installing Harbor on Ubuntu 22.04.
Prerequisites
Before you begin, ensure you have:
- An Ubuntu 22.04 server or desktop system
- Docker installed on Ubuntu 22.04. If not installed, you can follow this guide: Docker Installation Guide for Ubuntu.
Step 1: Install Docker Compose
Install Docker Compose, a tool for defining and running multi-container Docker applications:
sudo apt update
sudo apt install -y docker-compose
Step 2: Clone Harbor GitHub Repository
Clone the Harbor GitHub repository to your Ubuntu server:
git clone https://github.com/goharbor/harbor.git
Step 3: Configure Harbor
Navigate to the Harbor directory and edit the harbor.yml
configuration file:
cd harbor
cp harbor/harbor.yml.tmpl harbor/harbor.yml
nano harbor/harbor.yml
Update the hostname and other configuration settings as needed.
Step 4: Generate SSL Certificate
If you have an SSL certificate, copy it to the Harbor directory. Otherwise, generate a self-signed certificate:
./prepare
Step 5: Install Harbor
Run the following command to install Harbor:
sudo ./install.sh --with-notary --with-trivy
This command will install Harbor along with Notary for image signing and Trivy for vulnerability scanning.
Step 6: Access Harbor Web Interface
Open a web browser and navigate to https://your_server_ip
to access the Harbor web interface.
Log in with the default administrator credentials (admin/Harbor12345) and follow the on-screen instructions to configure Harbor.
Step 7: Configure Docker Daemon
Configure Docker daemon to trust the Harbor CA certificate:
sudo mkdir -p /etc/docker/certs.d/your_server_ip
sudo cp harbor/ssl/ca.crt /etc/docker/certs.d/your_server_ip/ca.crt
sudo systemctl restart docker
Conclusion
Congratulations! You have successfully installed Harbor Docker Image Registry on Ubuntu 22.04. You can now use Harbor to store and manage your container images.