当前位置:网站首页>Harbor:修改默认的172网段
Harbor:修改默认的172网段
2022-07-15 21:01:00 【琦彦】

背景: harbor 默认启动会随机创建 172 网段的ip地址,跟集群规划的网段冲突
Harbor 网段修改步骤
0. 原来Harbor占用的网段
# 网桥名:harbor_harbor
[[email protected] test]# docker network ls
NETWORK ID NAME DRIVER SCOPE
da8684ecc4b6 harbor_harbor bridge local
# 查看路由表
[[email protected] test]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.21.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-da8684ecc4b6
# 查看网桥内部信息
docker inspect da8684ecc4b6
# 确认到Harbor占用的网段是172.21.0.0,和公司规划冲突
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-B4zFPkVD-1657849708271)(https://cdn.jsdelivr.net/gh/Fly0905/[email protected]/imag/202207141603387.png)]
1、停止harbor
#停止harbor
docker-compose -f /opt/harbor/docker-compose.yml down
[[email protected] harbor]# docker-compose -f /opt/harbor/docker-compose.yml down
Stopping harbor-jobservice ... done
Stopping nginx ... done
Stopping harbor-core ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping registryctl ... done
Stopping redis ... done
Stopping harbor-portal ... done
Stopping harbor-log ... done
Removing harbor-jobservice ... done
Removing nginx ... done
Removing harbor-core ... done
Removing harbor-db ... done
Removing registry ... done
Removing registryctl ... done
Removing redis ... done
Removing harbor-portal ... done
Removing harbor-log ... done
Removing network harbor_harbor
# 查看网桥,确认harbor_harbor是否已经删掉
docker network ls
# 如果没有,使用以下命令删除网桥
# docker network remove [NETWORK ID]
2、创建Harbor新的网桥
# 创建Harbor新的网桥
docker network create --driver=bridge --subnet=172.252.0.1/16 harbor
# 验证网桥信息
[[email protected] harbor]# docker network ls
NETWORK ID NAME DRIVER SCOPE
e0a7e55534db harbor bridge local
[[email protected] harbor]# route -n | grep e0a7e55534db
172.252.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-e0a7e55534db
3、修改compose配置
# 2. 修改docker-compose.yml 把最下面network false 改成true
networks:
harbor:
external: true
4、重新启动
# 重新启动
docker-compose -f /opt/harbor/docker-compose.yml up -d --force-recreate
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3fOraodQ-1657849708272)(https://cdn.jsdelivr.net/gh/Fly0905/[email protected]/imag/202207141659623.png)]
注意
1. 启动方式
这种方式重启后,会使用新的网桥
但是使用.prepre命令重新生成配置文件后,或者./install.sh命令重装后,还是会创建harbor_harbor随机网桥,可能会冲突
所以,在使用.prepre命令或者./install.sh命令后,记得修改docker-compose.yml 把最下面network false 改成true
2. 使用非172网段
如果使用非172网段,在步骤2:创建Harbor新的网桥,还需要修改/etc/docker/daemon.json中的bip
因为doker默认使用的也是172网段,所以harbor指定的也是172网段,就不需要额外修改docker配置,只需要修改harbor配置就好了
#修改docker 网络地址
$ cat /etc/docker/daemon.json
{
// 修改bip--network bridge IP
"bip":"172.254.0.1/16"
}
# 重启docker
systemctl daemon-reload
systemctl start docker
参考链接
https://docs.docker.com/engine/reference/commandline/dockerd/#/linux-configuration-file
https://goharbor.io/docs/2.0.0/install-config/run-installer-script/
ne/reference/commandline/dockerd/#/linux-configuration-file
https://goharbor.io/docs/2.0.0/install-config/run-installer-script/
https://docs.docker.com/compose/compose-file/
边栏推荐
- 大型互联网应用的技术选型和决策,10 条成功与失败的记录
- C language custom type (struct, bit segment, enumeration, Union)
- 微服务架构 | 服务隔离 - [Gateway]
- Functional, module quality and non functional testing
- Huawei Router: multi area OSPF protocol experiment
- In the first half of 2022, 40 new unicorns, 30% of which have been invested by Sequoia China
- in_array的第3个参数实例分析
- (板子)Trie树模板 AcWing835. Trie字符串统计
- Shiro integrates redis to realize distributed session processing
- Network information viewing and configuration
猜你喜欢

8 about promise Then and promise Catch interview questions, we must master

接口测试实战 - 学生信息管理系统

CAN Communication (1) - CAN Communication Physical Layer

【直播回顾】OpenHarmony知识赋能六期第三课—OpenHarmony智能家居项目之控制面板功能实现
![Microservice architecture | service isolation - [gateway]](/img/02/4d882a5a13876645ef40ed6dabec3e.png)
Microservice architecture | service isolation - [gateway]

Centos7.2 install mysql5.7 through RPM package

华为交换技术:BGP基础实验

Centos7 installs MySQL 5.7 through Yum and enables remote access

UDS常见服务之安全访问 0x27

Logic Pro 使用教程之 Quick Sampler(非常详细)
随机推荐
【踩坑】复活 Pico-Go
nodeJS中npm简介与使用方法
mysql: command not found 找不到mysql命令
功能、模块质量和非功能性测试
Stm32f030 is stuck with timer interrupt
Leetcode-240-search two-dimensional matrix II
从错误页面的角度看用户体验
Centos7通过Yum安装MySql5.7并开启远程访问
笔试强训第15天
Chapter 2人口数据分析
对象转换的问题
160_技巧_Power BI 新函数-计算工作日天数
金太阳国信证券安全吗?可以在上面开户吗?
JUC并发包—CountDownLatch
模拟卷Leetcode【普通】1996. 游戏中弱角色的数量
golang怎么根据生日计算星座和属相
(板子)Trie树模板 AcWing835. Trie字符串统计
CAN通信(2)——CAN通信协议层
再议单例模式和静态类
JUC并发包—Semaphore