Harbor:
注意:
1.7版本之之前的版本的配置方式是一样的,从1.8版本开始和以前的版本不兼容
Harbor 1.10.1配置
1.先安装docker
2·再安装docker compose
3·部署harbor
harbor-offline-installer-v1.10.1.tgz
解压,进去
root@ubuntu:/usr/local/src/harbor# vim harbor.yml
hostname: image.harbor.com
harbor_admin_password: 123456
数据库,ssl...
hosts
10.0.0.182 image.harbor.com
root@ubuntu:/usr/local/src/harbor# ls
common.sh harbor.v1.10.1.tar.gz harbor.yml install.sh LICENSE prepare
root@ubuntu:/usr/local/src/harbor# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 19.03.12
[Step 1]: checking docker-compose is installed ...
✖ Need to install docker-compose(1.18.0+) by yourself first and run this script again.
安装docker-compose
root@ubuntu:/usr/local/src/harbor# apt install python3-pip
# pip3 install docker-compose
安装
root@ubuntu:/usr/local/src/harbor# docker-compose --version
docker-compose version 1.26.2, build unknown
root@ubuntu:/usr/local/src/harbor# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 19.03.12
。。。
报错:
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /usr/local/src/harbor
ERROR:root:Error: The protocol is https but attribute ssl_cert is not set
`root@ubuntu:/usr/local/src/harbor# vim harbor.yml 把https注释 `
# ./install.sh
✔ ----Harbor has been installed and started successfully.----
访问 http://image.harbor.com/
admin
123456
客户机修改配置并登录
root@ubuntu:~# vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 10.0.0.181:5000 --insecure-registry image.harbor.com
root@ubuntu:~# systemctl daemon-reload
sroot@ubuntu:~# systemctl restart docker
root@ubuntu:~# vim /etc/hosts
10.0.0.182 image.harbor.com
登录
root@ubuntu:~# docker login image.harbor.com
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
push本地镜像
root@ubuntu:~# docker tag alpine-nginx:app1 image.harbor.com/project1/nginx:1.18.0-alpine
root@ubuntu:~# docker push image.harbor.com/project1/nginx:1.18.0-alpine
The push refers to repository [image.harbor.com/project1/nginx]
98d66cba8028: Pushed
7a4b86b54952: Pushed
e7f79638b0e6: Pushed
5d573a27b9e7: Pushed
f6cc95df2725: Pushed
8d63d606a292: Pushed
f6dacd2090ae: Pushed
8f7010865bf2: Pushed
50644c29ef5a: Pushed
1.18.0-alpine: digest: sha256:01101ee90f9b8c1eba201a6bff96b780045bb2c408afc0188f9c2cb63b6ffd4e size: 2203
换一台机器pull
下载不需要登录认证(公开)
root@ubuntu:~# vim /etc/hosts
root@ubuntu:~# vim /lib
lib/ lib64/
root@ubuntu:~# vim /lib/systemd/system/docker.service
root@ubuntu:~# systemctl daemon-reload
root@ubuntu:~# systemctl restart docker
root@ubuntu:~# docker pull image.harbor.com/project1/nginx:1.18.0-alpine
1.18.0-alpine: Pulling from project1/nginx
公开勾掉
}root@ubuntu:~#docker pull image.harbor.com/project1/nginx:1.18.0-alpine
Error response from daemon: pull access denied for image.harbor.com/project1/nginx, repository does not exist or may require 'docker login'
harbor 1.7.6配置
详细见杰哥文档
两台机器
10.0.0.182
10.0.0.183
1.先安装docker
2·再安装docker compose
3·部署harbor
都上传harbor-offline-installer-v1.7.6.tgz
两台机器都
root@ubuntu:/usr/local/src/harbor# pwd
/usr/local/src/harbor
root@ubuntu:/usr/local/src/harbor# vim docker-compose.yml
root@ubuntu:/usr/local/src/harbor# vim harbor.cfg
hostname = 10.0.0.182
ui_url_protocol = http
email_identity = harbor
email_server = smtp.163.com
email_server_port = 25
email_username = 17638230357@163.com
email_password = DUEHIPHOQTVDLYPT
email_from = admin 17638230357@163.com
email_ssl = false
email_insecure = false
harbor_admin_password = 123456
apt install python2.7
apt install python-pip
pip install docker-compose
root@ubuntu:/usr/local/src/harbor # ./install.sh
分别访问
http://10.0.0.182/
http://10.0.0.183/
都创建project1
在镜像机10.0.0.180上push
root@ubuntu:~# vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 10.0.0.182 --insecure-registry 10.0.0.183
root@ubuntu:~# systemctl daemon-reload
root@ubuntu:~# systemctl restart docker.service
root@ubuntu:~# docker tag alpine-nginx:app1 10.0.0.182/project1/nginx:1.18.0-alpine
root@ubuntu:~# docker login 10.0.0.182
Login Succeeded
root@ubuntu:~# docker push 10.0.0.182/project1/nginx:1.18.0-alpine
1.18.0-alpine: digest: sha256:01101ee90f9b8c1eba201a6bff96b780045bb2c408afc0188f9c2cb63b6ffd4e size: 2203
在镜像机10.0.0.181上pull
root@ubuntu:~# vim /lib/systemd/system/docker.service
root@ubuntu:~# systemctl daemon-reload
root@ubuntu:~# systemctl restart docker
root@ubuntu:~# docker pull 10.0.0.182/project1/nginx:1.18.0-alpine
1.18.0-alpine: Pulling from project1/nginx
两台机器同步镜像
另一台重复操作
此时上传镜像会同步
俩harbor节点,也可以把数据目录挂载同一个存储
但一般不常用
root@ubuntu:/usr/local/src/harbor# vim docker-compose.yml
...
volumes:
- /data/registry:/storage:z
- ./common/config/registry/:/etc/registry/:z
- ./common/config/custom-ca-bundle.crt:/harbor_cust_cert/custom-ca-bundle.crt:z
...
之后打镜像可以
build-command.sh
#!/bin/bash
docker build -t 172.31.6.103/linux39/haproxy:2.0.13-centos .
docker push 172.31.6.103/linux39/haproxy:2.0.13-centos
重启机器后
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
You need to run your command in the same folder as your doocker-compose.yml file https://github.com/docker/compose/issues/6361
root@ubuntu:/usr/local/src/harbor# docker-compose start
/usr/local/lib/python2.7/dist-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning,
Starting log ... done
Starting postgresql ... done
Starting redis ... done
Starting adminserver ... done
Starting registry ... done
Starting core ... done
Starting jobservice ... done
Starting portal ... done
Starting proxy ... done
Starting registryctl ... done
发表评论