Deploy docker private warehouse Harbor

Keywords: Docker Vmware SELinux pip

1, Environmental description

Operating system: CentOS 7.5

Software version: harbor 1.5.0

2, Software installation

1. Preparation before installation

# systemctl disable firewalld.service
# systemctl stop firewalld.service
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# setenforce 0
# hostnamectl --static set-hostname  docker-Harbor

Install docker CE, don't explain again

2.Download and unzip harbor

# wget http://harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz
# tar -zxvf harbor-offline-installer-v1.5.0.tgz -C /opt/software

3. Install docker compose

Method 1

# curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# docker-compose --version
docker-compose version 1.22.0, build f46880fe

Method two

# yum -y install epel-release python-pip
# pip install docker-compose
# docker-compose --version
docker-compose version 1.22.0, build f46880fe

4. Modify the configuration file

# vi /opt/software/harbor/harbor.cfg
 Modify hostname = {harbor host IP}

5. Install harbor

# cd /opt/software/harbor
# ./install.sh

[Step 0]: checking installation environment ...

Note: docker version: 18.03.1

Note: docker-compose version: 1.22.0

[Step 1]: loading Harbor images ...

View generated images and developed ports

# docker imags
docker: 'imags' is not a docker command.
See 'docker --help'
[root@harbor harbor]# docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
vmware/redis-photon           v1.5.0              7c03076402d9        2 months ago        207MB
vmware/clair-photon           v2.0.1-v1.5.0       7ae4e0670a3f        2 months ago        301MB
vmware/notary-server-photon   v0.5.1-v1.5.0       0b2b23300552        2 months ago        211MB
vmware/notary-signer-photon   v0.5.1-v1.5.0       67c41b4a1283        2 months ago        209MB
vmware/registry-photon        v2.6.2-v1.5.0       3059f44f4b9a        2 months ago        198MB
vmware/nginx-photon           v1.5.0              e100456182fc        2 months ago        135MB
vmware/harbor-log             v1.5.0              62bb6b8350d9        2 months ago        200MB
vmware/harbor-jobservice      v1.5.0              aca9fd2e867f        2 months ago        194MB
vmware/harbor-ui              v1.5.0              1055166068d0        2 months ago        212MB
vmware/harbor-adminserver     v1.5.0              019bc4544829        2 months ago        183MB
vmware/harbor-db              v1.5.0              82354dcf564f        2 months ago        526MB
vmware/mariadb-photon         v1.5.0              403e7e656499        2 months ago        526MB
vmware/postgresql-photon      v1.5.0              35c891dea9cf        2 months ago        221MB
vmware/harbor-migrator        v1.5.0              466c57ab0dc3        2 months ago        1.16GB
vmware/photon                 1.0                 4b481ecbef2a        3 months ago        130MB
# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:1514          0.0.0.0:*               LISTEN      5420/docker-proxy   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      887/sshd            
tcp6       0      0 :::443                  :::*                    LISTEN      5929/docker-proxy   
tcp6       0      0 :::4443                 :::*                    LISTEN      5914/docker-proxy   
tcp6       0      0 :::80                   :::*                    LISTEN      5970/docker-proxy

6. Access and log in to harbor(http://{harbor host ip}), default user name / password: admin / harbor 12345

7. Modify the configuration files of each docker node that needs to be connected to harbor

# vi /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://wghlmi3i.mirror.aliyuncs.com"],
  "insecure-registries":["{harbor Host IP}"]
}

# systemctl deamon-reload
# systemctl restart docker

8.harbor image operation

Image tagging

docker tag SOURCE_IMAGE[:TAG] {harbor Host IP}/library/IMAGE[:TAG]

Push mirror

# docker login {harbor host IP} / / execute on each host of the docekr client
Username (admin): admin
Password: 
Login Succeeded
# docker push {harbor host IP}/library/IMAGE[:TAG]

Pull mirror image

#docker pull {harbor host IP}/library/IMAGE[:TAG]

 

Posted by moonie on Fri, 31 Jan 2020 04:34:23 -0800