使用Harbor搭建Docker私有仓库
ip:192.168.0.145
环境设置
防火墙,selinux等,可以使用本章开头的那个shell脚本
其他主机的hosts文件也都添加上
ip hub.aaa.com
windows系统的hosts也修改
安装docker,启动,开机启动
其他主机也都加上这个
vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"insecure-registries": ["https://hub.aaa.com"] # 仓库地址
}
添加后重启docker
下载配置docker-compose
官方地址:https://docs.docker.com/compose/install/
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
下载harbor软件
官方地址:https://github.com/goharbor/harbor/releases
官方说明文档:https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
证书文档:https://github.com/goharbor/harbor/blob/master/docs/configure_https.md
wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.0.tgz
tar -zxv -f harbor-offline-installer-v1.9.0.tgz -C /usr/local/
cd /usr/local/harbor
vim harbor.yml
# 可以使用80端口或443端口
hostname: hub.aaa.com
https:
port: 443
certificate: /usr/local/harbor/cert
private_key: /usr/local/harbor/cert
# 其余保持默认
# 创建上述俩目录
mkdir -p /usr/local/harbor/cert/
# 创建整数
cd /usr/local/harbor/cert
openssl genrsa -out ca.key 4096
# 这一步注意域名,其他信息比如地区城市等可以酌情修改
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=TW/ST=Taipei/L=Taipei/O=example/OU=Personal/CN=hub.aaa.com" \
-key ca.key \
-out ca.crt
openssl genrsa -out hub.aaa.com.key 4096
openssl req -sha512 -new \
-subj "/C=TW/ST=Taipei/L=Taipei/O=example/OU=Personal/CN=hub.aaa.com" \
-key hub.aaa.com.key \
-out hub.aaa.com.csr
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=hub.aaa.com
EOF
openssl x509 -req -sha512 -days 3650 \
-extfile v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in hub.aaa.com.csr \
-out hub.aaa.com.crt
chmod a+x *
# 再次编辑配置文件,配置上证书
vim /usr/local/harbor/harbor.yml
certificate: /usr/local/harbor/cert/hub.aaa.com.crt
private_key: /usr/local/harbor/cert/hub.aaa.com.key
# 校验
cd /usr/local/harbo
./prepare
# 安装
./install.sh
# 安装之后的提示
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis ... done
Creating registry ... done
Creating harbor-portal ... done
Creating harbor-db ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at https://hub.aaa.com.
For more details, please visit https://github.com/goharbor/harbor .
# 查看
docker ps -a
# 打开浏览器访问https://hub.aaa.com
# 用户名:admin
# 密码:Harbor12345
# 可以在harbor.yml文件中查看修改
# 其他K8S节点登陆验证
docker login https://hub.aaa.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
# 退出登陆
docker logout https://hub.aaa.com
测试
# 其他节点主机下载镜像推送到仓库,使用的是一个测试的镜像
docker pull wangyanglinux/myapp:v1
# web页面,项目,library,镜像仓库,右上角有一个推送镜像:
# 在项目中标记镜像:docker tag SOURCE_IMAGE[:TAG] hub.aaa.com/library/IMAGE[:TAG]
# 推送镜像到当前项目:docker push hub.aaa.com/library/IMAGE[:TAG]
# 给镜像重新打标签
docker tag wangyanglinux/myapp:v1 hub.aaa.com/library/myapp:v1
# 需要先登陆,然后才能push
docker push hub.aaa.com/library/myapp:v1
# 此时在web界面就可以查看到推送过来的镜像
使用Harbor搭建Docker私有仓库的更多相关文章
- CentOS7下使用Harbor搭建Docker私有仓库
相关资料: Harbor官方网站:https://goharbor.io/ Harbor Github地址:https://github.com/goharbor/harbor ⒈安装Docker(必 ...
- 一步步搭建docker私有仓库并从私有仓库中下载镜像
一步步搭建docker私有仓库 #下载镜像 docker pull registry#查看镜像 docker images #运行私有仓库,指定端口和数据卷 docker run -d -p : -v ...
- 搭建docker私有仓库
保存镜像的地方成为仓库(registry).目前有2种仓库:公共仓库和私有仓库. 最方便的是使用公共仓库上传和下载镜像,下载不需要注册,上传需要到公共仓库注册.公共仓库网站:https://hub.d ...
- windows 环境下搭建docker私有仓库
windows 环境下搭建docker私有仓库 1.在公用仓库中pull仓库镜像 docker pull regitry 2.启动仓库镜像 //-d意思是后台运行,-p是做端口映射,这里是将本地的50 ...
- Docker自学纪实(六)搭建docker私有仓库
docker的镜像仓库分两种:一种是从官方公有仓库拉取:还有就是自己搭建私有仓库.官方的镜像仓库是面对整个应用市场的:私有仓库一般用于公司内部,就是公司项目自身所需的镜像.搭建私有仓库有什么好处?私有 ...
- 03搭建docker私有仓库
搭建docker私仓,可以使用docker官方提供的registry镜像.该镜像目前有2.0,2.3和2.3.1版本.它只与1.6.0以上版本的docker兼容.搭建私仓的步骤如下: 一:无代理.无认 ...
- CentOS7搭建Docker私有仓库----Docker
有时候使用Docker Hub这样的公共仓库可能不方便,这种情况下用户可以使用registry创建一个本地仓库供私人使用,这点跟Maven的管理类似.目前Docker Registry已经升级到了v2 ...
- 搭建docker私有仓库,建立k8s集群
服务器IP角色分布 192.168.5.2 etcd server 192.168.5.2 kubernetes master 192.168.5.3 kubernetes node 192.168. ...
- 搭建docker私有仓库(https)
1.修改openssl.cnf,支持IP地址方式,HTTPS访问在Redhat7或者Centos系统中,文件所在位置是/etc/pki/tls/openssl.cnf.在其中的[ v3_ca]部分,添 ...
随机推荐
- elasticsearch sql插件 2.4及以下版本配置
github地址:https://github.com/NLPchina/elasticsearch-sql/ 方式一:github elasticsearch-sql上提供的安装方法cmd进入到本地 ...
- docker 容器连接 host的sql server失败
报错内容::“A network-related or instance-specific error occurred while establishing a connection to SQL ...
- 基本PSO算法实现(Java)
一.算法流程 Step1:初始化一群粒子(粒子个数为50个),包括随即位置和速度: Step2:计算每个粒子的适应度fitness: Step3:对每个粒子,将其适应度与其进过的最好位置(局部)pbe ...
- FreeMarker学习(springmvc配置)
springMvc配置 <bean id="freemarkerConfig" class="org.springframework.web.servlet.vie ...
- mongodb 数据更新命令、操作符
一.Mongodb数据更新命令 Mongodb更新有两个命令:update.save. 1.1update命令 update命令格式: db.collection.update(criteria,ob ...
- 安装windows下安装mysql
参考文档:https://www.cnblogs.com/reyinever/p/8551977.html https://www.jb51.net/article/151213.htm 首先下载m ...
- yum -y与 yum有什么区别
在linux中,经常使用yum来进行软件的安装,更新与卸载,那我们会发现,在使用yum的时候,通常有下面两种指令模式: ①yum install xxx ②yum -y install xx 那这 ...
- 001-多线程-JUC线程池-线程池架构-Executor、ExecutorService、ThreadPoolExecutor、Executors
一.概述 1.1.线程池架构图 1. Executor 它是"执行者"接口,它是来执行任务的.准确的说,Executor提供了execute()接口来执行已提交的 Runnable ...
- 5G 与 MEC 边缘计算
目录 文章目录 目录 前言 参考文献 通信网络 核心网演进之路 早古时期 2G 网络架构 3G 网络架构 4G 网络架构 5G 5G 网络的需求 5G 网络架构的设计原则 5G 网络的逻辑架构 5G ...
- 记录下关于RabbitMQ常用知识点(持续更新)
1.端口及说明: 4369 -- erlang发现口 5672 --client端通信口 15672 -- 管理界面ui端口 25672 -- server间内部通信口 举例说明 我们访问Rabbit ...