假设当前您的CentOS系统是全新安装,以下所有操作都是用root账号进行的;
yum update -y
systemctl stop firewalld;systemctl disable firewalld;setenforce 0
为了能顺利安装应用,建议更新yum源;
yum -y install wget
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
yum -y update
groupadd docker
gpasswd -a root docker
curl -sSL https://get.docker.com | sh
systemctl start docker && systemctl enable docker
[root@centos7 ~]# docker version
Client: Docker Engine - Community
Version: 19.03.11
API version: 1.40
Go version: go1.13.10
Git commit: 42e35e61f3
Built: Mon Jun 1 09:13:48 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.11
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 42e35e61f3
Built: Mon Jun 1 09:12:26 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
推荐安装docker镜像加速器,方法有多种,如果您有阿里云的注册账号可以参考以下操作:
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxxxx.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload \
&& systemctl restart docker
yum -y install tree python-devel gcc epel-release python-pip
注意:上述操作如果遇到安装失败,请分开重试;
pip install --upgrade pip
pip install docker-compose
[root@centos7 ~]# docker-compose version
docker-compose version 1.26.0, build unknown
docker-py version: 4.2.1
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
wget https://github.com/goharbor/harbor/releases/download/v1.10.3/harbor-online-installer-v1.10.3.tgz \
&& tar -zxvf harbor-online-installer-v1.10.3.tgz
[root@centos7 ~]# tree harbor
harbor
├── common.sh
├── harbor.yml
├── install.sh
├── LICENSE
└── prepare
[root@centos7 harbor]# clear
[root@centos7 harbor]# ./prepare
prepare base dir is set to /root/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /secret/keys/secretkey
Generated certificate, key file: /secret/core/private_key.pem, cert file: /secret/registry/root.crt
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
...
...
Digest: sha256:7903f39d47db4182f424539ec36294c407e7ac1e2e39fa095609a296e180b9e0
Status: Downloaded newer image for goharbor/harbor-registryctl:v1.10.3
Creating harbor-log ... done
Creating harbor-db ... done
Creating registry ... done
Creating redis ... done
Creating harbor-portal ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----
至此,harbor部署成功,接下来验证一下是否可用;
{
"insecure-registries":["192.168.133.174"]
}
systemctl daemon-reload && systemctl restart docker
再次提醒:这里修改是远程连接Harbor服务的机器的配置,而不是Harbor服务器的配置;
[root@centos7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 2eb5a120304e 3 days ago 647MB
docker tag 2eb5a120304e 192.168.133.174/library/tomcat:latest
[root@centos7 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.133.174/library/tomcat latest 2eb5a120304e 3 days ago 647MB
tomcat latest 2eb5a120304e 3 days ago 647MB
docker login 192.168.133.174 -u admin -p Harbor12345
docker push 192.168.133.174/library/tomcat:latest
至此,harbor-1.10的部署和验证就完成了,如果您也在部署harbor,希望本文能给您一些参考;
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。