Implementation method of building docker private warehouse in harbor


1 open source warehouse management tool harbor

HarborIt’s aCNCFManaged open sourceDockerMirror warehouse management tool, through which we can quickly establish our own private warehouse. Of course, there are many options for building private warehouses, such asDockerOfficially providedregistryMirror orNexusWait. butHarborIt is a good choice.

2 installation

HarborThere are also many installation methods, such as installing through the command lineHelmInstallation, etc. This article demonstrates the installation through the script on the command line.

2.1 installing docker and docker compose

firstDockerIs to be installed,HarborIt is started through a pile of containers. It also needs to be installeddocker-compose, and there are certain requirements for the version. HereRancherFind the software package in the resource library of and configure it:


mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose

2.2 installing harbor

2.2.1 download and unzip

arrive earlier thanGitHub ReleaseDownload the corresponding package, includingofflineandonlineTwo,offlineRelatively large, including the corresponding dependencies;onlineThe corresponding dependent components are not included, and they need to be downloaded during installation. Use hereonlineBecause fromGithubIt’s not necessarily fast to download things.




tar zxvf harbor-online-installer-v2.1.1.tgz

2.2.2 configuration and installation

Prepare profile:

cp harbor.yml.tmpl harbor.yml

Modify configuration:vi harbor.yml, mainlyhttpsRemove and configure the server address and password. Key configurations are:

  port: 8088
# https related config
  # https port for harbor, default is 443
  # port: 443
  # The path of cert and key files for nginx
  #certificate: /your/certificate/path
  #private_key: /your/private/key/path
harbor_admin_password: Harbor12345

After changing the configuration, start the installation:


You will be prompted if the installation is successful.

3 simple use

3.1 creating users with admin

visit:, you can log in and use it. The user name isadmin, the default password isHarbor12345

Manage usersadminPermission is too high. To create an ordinary user:

Create user information:

3.2 project created by new user

sign outadmin, log in with the newly created user, and then create a project to store the image:

Project created successfully:

3.3 docker connection warehouse

3.3.1 modify the docker configuration and restart

There’s one on onedockerConfiguration on machinedaemon.json, increase"insecure-registries": [""],

vi /etc/docker/daemon.json

After configuration, the contents are as follows:

  "insecure-registries": [""],
  "registry-mirrors": [""],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  "storage-driver": "overlay2"


systemctl restart docker

3.3.2 login and push image

Log in to the new warehouse:

$ docker login --username pkslow --password Pk123456
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See

Login Succeeded

Make a for one of the imagestag

docker tag nginx

Upload image to warehouse:

$ docker push
The push refers to repository []
cdd1d8ebeb06: Pushed 
fe08d9d9f185: Pushed 
280ddd108a0a: Pushed 
f14cffae5c1a: Pushed 
d0fe97fa8b8c: Pushed 
latest: digest: sha256:4949aa7259aa6f827450207db5ad94cabaa9248277c6d736d5e1975d200c7e43 size: 1362

Go to the web page and check that there is already a corresponding image:

Pull and don’t demonstrate.

This is the end of this article about the implementation method of building docker private warehouse in harbor. For more information about building docker private warehouse in harbor, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!

Recommended Today

Apache sqoop

Source: dark horse big data 1.png From the standpoint of Apache, data flow can be divided into data import and export: Import: data import. RDBMS—–>Hadoop Export: data export. Hadoop—->RDBMS 1.2 sqoop installation The prerequisite for installing sqoop is that you already have a Java and Hadoop environment. Latest stable version: 1.4.6 Download the sqoop installation […]