/private-docker-registry

Private docker registry documentation dockister.di.unipi.it

MIT LicenseMIT

Private Docker Registry

This is the documentation of the private docker registry at dockister.di.unipi.it using Harbor and Let Encrypt.

Harbor is an open source private registry o container images and Helm charts, devloped by VMWare. It offers a registry, a web interface, LDAP integration, API management, two-way replication to many cloud registry (as GitHub registry - ghcr.io) and much more.

Usage

Push

git clone https://github.com/Unipisa/test-github-docker-registry.git
cd test-github-docker-registry
docker build -t test .
docker tag test dockister.di.unipi.it/test/test:v0 
docker push dockister.di.unipi.it/test/test:v0

Pull

docker pull dockister.di.unipi.it/test/test:v0

Login

docker login dockister.di.unipi.it --username a040515

Installation

Setup Certificate

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
certbot certonly --standalone -d dockister.di.unipi.it

Install Harbor

sudo usermod -aG docker $USER
sudo systemctl stop apache2
sudo systemctl disable apache2
 curl -s https://api.github.com/repos/goharbor/harbor/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep '\.tgz$' | wget -i -
tar xvzf harbor-offline-installer*.tgz
cd harbor
nano harbor.yml

edit with

hostname: dockister.di.unipi.it

https:
  port: 443
  certificate: /etc/letsencrypt/live/dockister.di.unipi.it/fullchain.pem
  private_key: /etc/letsencrypt/live/dockister.di.unipi.it/privkey.pem

database:
  password: $STRONG_PASS

data_volume: $SOME_DIR

then install with

sudo ./install.sh

and run with

docker-compose up -d

Setup LDAP authentication

By web gui go to setting, configuration

ldap settings

Manage repositories

By web gui

manage repositories

By API

manage repositories

Notes

Add replication to GitHub

docker exec -u 0 -it 17d3498715b0 bash
$ echo "140.82.121.34 ghcr.io" >> /etc/hosts

where 17d3498715b0 is for goharbor/harbor-core

or

    networks:
      - harbor
    extra_hosts:
      - "ghcr.io:140.82.121.34"

in docker-compose.yml.