Harbor Installation On Docker

Oğuzhan Cingöz
KoçSistem
Published in
2 min readDec 2, 2022

Download the Harbor installers from the official releases page. Download either the online installer or the offline installer.

  • Online installer: The online installer downloads the Harbor images from Docker hub. For this reason, the installer is very small in size.
  • Offline installer: Use the offline installer if the host which is deploying Harbor does not have a connection to the Internet. The offline installer contains pre-built images, so it is larger than the online installer.
  • Create docker-volumes folder under data folder
  • Create harbor folder under docker-volumes folder
  • Create docker-files folder under data folder

The installation processes are almost the same for the online and offline installers.

Online installer:

cd docker-files
tar xzvf harbor-online-installer-version.tgz

Offline installer:

cd docker-files
tar xzvf harbor-offline-installer-version.tgz
cd /data/docker-files/harbor
mv harbor.vx.x.x.tar.gz /data/docker-volumes/harbor
mv harbor.yml.tmp harbor.yml
vi harbor.yml

set hostname : registry.xxx.com

close https configuration

set data_volume:/data/docker-volumes/harbor

save and quit

run ./install.sh

It’s okey. You can go to your url “http://registry.xxx.com"

HTTPS Configuration

We need 3 file ( ca.crt , your.domain.crt, yourdomain.key)

Copy the server certificate and key into the certificates folder on your Harbor host.

cd /data
mkdir cert
cd cert
cp yourdomain.crt .
cp yourdomain.key .

Copy the server certificate, key and CA files into the Docker certificates folder on the Harbor host.

openssl x509 -inform PEM -in yourdomain.crt -out yourdomain.cert
cd /etc/docker
mkdir certs.d
cd certs.d
mdkir registry.xxx.com
cd registry.xxx.com
cp yourdomain.crt .
cp yourdomain.key .
cp ca.crt .
systemctl restart docker
cd /data/docker-files/harbor
./prepare
docker-compose up -d

It’s okey. You can go to your url “https://registry.xxx.com"

Docker Login Error

Some errors occurred try login to registry for example http 500, 509 etc

cd /data/docker-volumes/harbor/secret/core
mv private_key.pem private_key2.pem
cp /etc/docker/certs.d/registry.xxx.com/yourdomain.key .
mv yourdomain.key private_key.pem

That’s all. You can login registry.

If any server or pc don't connect regisrty. You should copy ca.crt file to your server /etc/docker/certs.d/registry.xxx.com path and restart Docker.

--

--