When dealing with Docker, sooner or later we have to find a way to store images and share it between machines. Default solution is Docker Hub, but it can get quite expensive, and we don’t have enough control over it.
As an alternative, we can use free Harbor, an enterprise-class Docker registry. Atfter installing it on our server, we can store as many Docker images as we want (and disk space allow).
We can install it with HTTPS so there will be no need to add
--insecure-registry flag to Docker. It will save us a lot of time in the future.
I prefer installing it on separate, clean server.
We are going to run all commands as root.
0 . Prerequisites
Before we start, we need to have installed:
- Python 2.7+ (
apt-get install pythonon Ubuntu)
- Docker engine 1.10+ (guide)
- Docker Compose 1.6.0+ (guide)
1 . Download online installer, get the newest version on Harbor releases page, e.g.
2 . Extract it
3 . Generate your own SSL certificate (replace reg.example.com with your host’s FQDN.
In the creator we can choose default options except for
Common name, don’t forget to input your host’s FQDN:
3 . Change directory and edit harbor.cfg file
Change hostname to the host’s IP (not localhost) or FQDN and enable https
Set certificate path.
4 . Intall Harbor
5 . Run it in background.
After going to our FQDN in the browser, we can see working application
The default password for
Don’t forget to change it in Account Settings
On every machine where we want to connect to the server we need to do the following:
1 . On server copy certificate content
2 . Paste it to the host in the following file:
3 . Link file to system certificates.
Now we can login to the registry
Use the same password as for web UI.
In Harbor projects tab, create a new project.
To push the image to the project, we first have to tag it using the following schema:
To achieve it, we can tag an existing image:
Or specify tag during build using
If we’re using Docker Compose, we can also specify a name in
Harbor is really powerful and easy to use and manage.
Its upkeep can be dirt cheap if we’re using a server which we’re paying for only when it’s running, especially compared to Docker Hub with $7 for only 5 private repositories.