共计 3721 个字符,预计需要花费 10 分钟才能阅读完成。
本篇文章给大家分享的是有关怎么进行 VMware Harbor 部署,丸趣 TV 小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着丸趣 TV 小编一起来看看吧。
了解一下怎么部署 harbor。
系统
OS:Ubuntu 16.04.3 LTS
Kernel:ubuntu16.04-2 4.4.0-87-generic
下载 docker-ce
我跟她 https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.03.0~ce-0~ubuntu_amd64.deb
安装 docker-ce
dpkg -i docker-ce_18.03.0_ce-0_ubuntu_amd64.deb
检查 docker-ce
docker info
依赖安装
apt-get install python2.7 python-minimal
docker-compose 安装
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ps:不要 apt-get install docker-compose 安装,默认仓库中的 docker-compose 版本太低
docker-compose 自动补全插件安装
curl -L https://raw.githubusercontent.com/docker/compose/1.19.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
harbor 离线包下载
cd /opt/programs
wget https://storage.googleapis.com/harbor-releases/release-1.5.0/harbor-offline-installer-v1.5.1.tgz
========================= 下载完解压 ========================================
tar zxvf harbor-offline-installer-v1.5.1.tgz
工作目录设定
/opt/programs/harbor
调整 harbor.cfg 配置
文件在 /opt/programs/harbor
/harbor.cfg
_version = 1.5.0
hostname = 192.168.1.6
ui_url_protocol = http
max_job_workers = 5
customize_crt = on
ssl_cert = /data/cert/server.crt
ssl_cert_key = /data/cert/server.key
secretkey_path = /data
admiral_url = NA
log_rotate_count = 5
log_rotate_size = 200M
http_proxy =
https_proxy =
no_proxy = 127.0.0.1,172.31.68.243,ui
email_identity =
email_server = smtp.mydomain.com
email_server_port = 25
email_username = sample_admin@mydomain.com
email_password = abc
email_from = admin sample_admin@mydomain.com
email_ssl = false
email_insecure = false
harbor_admin_password = Harbor12345
auth_mode = db_auth
ldap_url = ldaps://ldap.mydomain.com
ldap_basedn = ou=people,dc=mydomain,dc=com
ldap_uid = uid
ldap_scope = 2
ldap_timeout = 5
ldap_verify_cert = true
ldap_group_basedn = ou=group,dc=mydomain,dc=com
ldap_group_filter = object "mysql" target="_blank" href="https://www.yisu.com/mysql/">mysql
db_password = root123
db_port = 3306
db_user = root
redis_url = redis:6379
clair_db_host = postgres
clair_db_password = password
clair_db_port = 5432
clair_db_username = postgres
clair_db = postgres
uaa_endpoint = uaa.mydomain.org
uaa_clientid = id
uaa_clientsecret = secret
uaa_verify_cert = true
uaa_ca_cert = /path/to/ca.pem
registry_storage_provider_name = filesystem
registry_storage_provider_config =
安装 harbor
./install.sh
查看 harbor image
docker image ls
查看 harbor container
docker container ls
登录 harbor
http://192.168.1.6
ps:默认用户名密码是 admin/Harbor12345
管理界面
ps:怎么使用就不详细描述了,下面讲解一下怎么 push 镜像上去,换一台机 ubuntu 机器执行以下命令 (ubuntu16.04-2)
调整 docker 默认配置
#/etc/docker/daemon.json
registry-mirrors : [http://aa2fd190.m.daocloud.io],
insecure-registries :[http://172.31.68.241]
}
调整 docker 启动配置文件
#/lib/systemd/system/docker.service
# 在 service 模块下调整 ExecStart 项
[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
配置生效
systemctl daemon-reload
systemctl restart docker.service
查看 docker 状态
systemctl status docker.service
CLI 登录 harbor
docker login 192.168.1.6
root@ubuntu16.04-2:~#docker login 192.168.1.6
Username (admin): admin
Password:
Login Succeeded
root@ubuntu16.04-2:~#
image 打 tag
先检查当前主机上的 image
针对 hello-world 打 tag
ps:里面的 ip 换成 192.168.1.6(实在是没图了)
docker tag hello-world:latest 172.31.68.241/library/hello-world:latest
push 镜像
docker push 172.31.68.241/library/hello-world:latest
pull 镜像 调整 docker 配置文件
#/etc/default/docker
# 调整 DOCKER_OPTS 如下
DOCKER_OPTS= --registry-mirror=http://172.31.68.241 --insecure-registry 172.31.68.241
重启 docker
systemctl daemon-reload
systemctl restart docker.service
pull 镜像
docker pull 172.31.68.241/library/hello-world
以上就是怎么进行 VMware Harbor 部署,丸趣 TV 小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注丸趣 TV 行业资讯频道。