标签:refers rom epo nload mon 状态 hosts install dir
[root@cicd kubernetes]# cd harbor [root@cicd harbor]# ls common docker-compose.notary.yml ha harbor.v1.4.0.tar.gz LI docker-compose.clair.yml docker-compose.yml harbor.cfg install.sh
root@cicd kubernetes]# mv harbor /opt/
[root@cicd kubernetes]# cd /opt/
[root@cicd opt]# ls
harbor
[root@cicd /]# mkdir data
[root@cicd data]# mkdir harbor
然后cd到kubernetes目录下解压ca.tar.gz,将解压后的ca目录移动到创建的/data/harbor/目录并重命名为cert
[root@cicd harbor]# cd /root/kubernetes [root@cicd kubernetes]# ls bash ca.tar.gz harbor-offline-installer-v1.4.0.tgz image image.tar.gz k8s197.tar.gz [root@cicd kubernetes]# tar zxf ca.tar.gz [root@cicd kubernetes]# ls bash ca ca.tar.gz harbor-offline-installer-v1.4.0.tgz image image.tar.gz k8s197.tar [root@cicd kubernetes]# mv ca /data/harbor/cert [root@cicd kubernetes]# cd /data/harbor/cert/ [root@cicd cert]# ls ca.crt ca.key ca.srl harbor.crt harbor.csr harbor.key
[root@cicd harbor]# cat docker-compose.clair.yml
volumes:
- /data/harbor/clair-db:/var/lib/postgresql/data:z
volumes:
- /data/harbor/notary-db:/var/lib/mysql:z
volumes: - /data/harbor/var/log/harbor/:/var/log/docker/:z - ./common/config/log/:/etc/logrotate.d/:z volumes: - /data/harbor/registry:/storage:z - ./common/config/registry/:/etc/registry/:z volumes: - /data/harbor/database:/var/lib/mysql:z volumes: - /data/harbor/config/:/etc/adminserver/config/:z - /data/harbor/secretkey:/etc/adminserver/key:z - /data/harbor/:/data/:z volumes: - /data/harbor/secretkey:/etc/ui/key:z - /data/harbor/ca_download/:/etc/ui/ca/:z - /data/harbor/psc/:/etc/ui/token/:z volumes: - /data/harbor/job_logs:/var/log/jobs:z - ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z - /data/secretkey:/etc/jobservice/key:z
4)编辑harbor.cfg文件
? ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at https://reg.yunwei.edu. For more details, please visit https://github.com/vmware/harbor .
[root@cicd opt]# docker-compose ps ERROR: Can‘t find a suitable configuration file in this directory or any parent. Are you in the right directory? #此报错就是因为没有再/opt/harbor目录下执行 Supported filenames: docker-compose.yml, docker-compose.yaml [root@cicd opt]# cd harbor/ [root@cicd harbor]# docker-compose ps Name Command State Ports ------------------------------------------------------------------------------------------------------------------------------ harbor-adminserver /harbor/start.sh Up harbor-db /usr/local/bin/docker-entr ... Up 3306/tcp harbor-jobservice /harbor/start.sh Up harbor-log /bin/sh -c /usr/local/bin/ ... Up 127.0.0.1:1514->10514/tcp harbor-ui /harbor/start.sh Up nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp registry /entrypoint.sh serve /etc/ ... Up 5000/tcp
可以看到所有容器的状态都为启动,即为成功部署了harbor。
/ # ansible all -m shell -a ‘mkdir -p /etc/docker/certs.d/reg.yunwei.edu‘ [WARNING]: Consider using file module with state=directory rather than running mkdir 192.168.253.9 | SUCCESS | rc=0 >> 192.168.253.10 | SUCCESS | rc=0 >> 192.168.253.11 | SUCCESS | rc=0 >> 192.168.253.14 | SUCCESS | rc=0 >>
可以看到四个节点都创建目录成功。注意此操作是在下载了ansible的容器里面。
[root@cicd reg.yunwei.edu]# cp ca.crt /etc/docker/certs.d/reg.yunwei.edu/
192.168.253.9 reg.yunwei.edu
[root@cicd ~]# docker login reg.yunwei.edu
Username: admin
Password:
Login Succeeded
注意需要命令行登陆了镜像库之后,才可以推送或者下载镜像从私有仓库中。
登陆用户名和密码后会有一个默认的library项目,可以选择新建项目。
[root@cicd ~]# docker tag nginx reg.yunwei.edu/test/nginx:latest [root@cicd ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE reg.yunwei.edu/test/nginx latest 719cd2e3ed04 9 days ago 109MB nginx latest 719cd2e3ed04 9 days ago 109MB 。。。
[root@cicd ~]# docker push reg.yunwei.edu/test/nginx The push refers to repository [reg.yunwei.edu/test/nginx] d7acf794921f: Pushed d9569ca04881: Pushed cf5b3c6798f7: Pushed latest: digest: sha256:079aa93463d2566b7a81cbdf856afc6d4d2a6f9100ca3bcbecf24ade92c9a7fe size: 948
[root@cicd ~]# docker pull reg.yunwei.edu/test/nginx:latest latest: Pulling from test/nginx Digest: sha256:079aa93463d2566b7a81cbdf856afc6d4d2a6f9100ca3bcbecf24ade92c9a7fe Status: Downloaded newer image for reg.yunwei.edu/test/nginx:latest
[root@node1 ~]# docker pull reg.yunwei.edu/test/nginx:latest
标签:refers rom epo nload mon 状态 hosts install dir
原文地址:https://www.cnblogs.com/zzzynx/p/11058933.html