Harbor warehouse using a mirror to create a docker

First, why use Harbor

  1. Harbor is a free open source software

  2. Harbor is for enterprise users

  3. Harbor has a relatively friendly WEB management interface


Two, Harbor official resources

https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
https://github.com/goharbor/harbor/releases


Third, a prerequisite: Installation docker

    1. Remove the old version of docker-ce

# yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

    2. Installation dependencies

# yum install -y yum-utils device-mapper-persistent-data lvm2

    3. Import repo warehouse

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

    4. Installation docker-ce

# yum install docker-ce docker-ce-cli containerd.io -y

    The mirror configuration aliyun acceleration (optional)

# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}

    6. Start docker Service

# systemctl daemon-reload
# systemctl start docker
# systemctl enable docker


Fourth, the two prerequisites: mounting docker-compose

    1. Download docker-compose executable file

# curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    2. endow docker-compose executable permissions

# chmod +x /usr/local/bin/docker-compose

    3. Test query docker-compose the current version

# docker-compose --version


Fifth, the installation configuration Harbor

    1. Harbor install the installation package is divided into online and offline installation, this installation by line installation, first download the installation files online through Web pages and extract

# tar xvf harbor-online-installer-<version>.tgz

    2. Modify harbor.yml profile

Vim harbor.yml # 
hostname: 192.168.0.131 # write the host name or IP address of the 
HTTP: 
  Port: 80 
harbor_admin_password: Harbor12345 # initialize the UI admin password, login can modify 
Database: 
  password: root123 
data_volume: / the Data # local data storage location 
log : # log configuration 
  Level: info 
  rotate_count: 50 
  rotate_size: 200M 
  LOCATION: / var / log / Harbor

    3. Install harbor

./Install.sh # 
		
### will download the following docker image file, the version you do not see 
the REPOSITORY TAG                      
goharbor / Redis-Photon v1.8.0                   
goharbor / Harbor-registryctl v1.8.0                   
goharbor / Registry-Photon-Patch v2.7.1-2819 -v1.8.0 
goharbor / Nginx-Photon v1.8.0                   
goharbor / Harbor-log v1.8.0                   
goharbor / Harbor-JobService v1.8.0                   
goharbor / Harbor-Core v1.8.0                   
goharbor / Harbor-Portal v1.8.0                    
goharbor / Harbor V1-DB .8.0                  
goharbor / PREPARE v1.8.0

    4. activate or deactivate harbor

# cd /PATH/harbor_install_dir/
# docker-compose start
# docker-compose stop
# docker-compose ps

    5. Modify harbor configuration, and start and reapply

# docker-compose down -v
# vim harbor.yml
# ./prepare
# docker-compose up -d

    6. completely remove harbor

# cd /PATH/harbor_install_dir/
# docker-compose down -v
# rm -r /data/database
# rm -r /data/register


Six, Docker client configuration

    1. docker host Add harbor warehouse address

# vim /etc/docker/daemon.json
{
  "insecure-registries": ["harbor_server_ip:80"]
}
# systemctl daemon-reload
# systemctl restart docker

    2. Test, upload local mirror to harbor warehouse

# docker login harbor_server_ip
# docker pull hello-world
# docker tag hello-world:latest harbor_server_ip:80/library/hello-world:latest
# docker push harbor_server_ip:80/library/hello-world:latest

    3. WEB address and the default user login password

http:harbor_server_ip

Username: admin
Password: Harbor12345


Guess you like

Origin blog.51cto.com/daibaiyang119/2437006