docker镜像仓库harbor的搭建与使用

一:我们在公司内部建立了Docker内部镜像仓库: harbor是vmware出的一个docker镜像仓库,本质是一组容器的集合体,算是一个多容器的pod. 数据卷缺省是宿主机的/data,所以我们把iscsiu挂在/data 主机:172.18.31.28 首先安装docker-ce 添加docker-ce源: yum install epel-release yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce -y yum install ntp -y 启动自动同步时间: timedatectl set-ntp yes #此处可用yes,no,1或0 配置时区: timedatectl set-timezone Asia/Shanghai 配置Docker启动参数: mkdir -p /etc/docker cat << EOF >> /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] } EOF 之后装的所有Docker的宿主机,如果要用到这个私有仓库的话: cat << EOF >> /etc/docker/daemon.json { "insecure-registries":["172.18.31.28"], "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] } EOF 启动docker systemctl enable docker && systemctl start docker ​ 安装Docker-compose ...

2022年12月19日 · 1 分钟 · 175 字 · 八戒

Docker的缺省网段冲突问题

docker默认网段是172.17,和公司的网段172.16和172.18有时候会冲突,解决方法就是换docker网段。 方案:不改docker网段,创建不和公司网段冲突的docker子网段 docker network create --driver=bridge --subnet=172.19.0.0/24 monitor_net 运行容器时指定 docker run -it --name <容器名> ---network monitor_net <镜像名> 在docker-compose同样通过networks指定,形式如下: version: '3' networks: monitor: #使用已经存在的网络 external: name: monitor_net services: prometheus: image: prom/prometheus container_name: prometheus hostname: prometheus privileged: true restart: always volumes: - /usr/local/src/config/prometheus.yml:/etc/prometheus/prometheus.yml - /usr/local/src/config/node_down.yml:/etc/prometheus/node_down.yml ports: - "9091:9090" networks: - monitor links: - alertmanager - node-exporter

2022年12月19日 · 1 分钟 · 54 字 · 八戒

Dell服务器设置远程文件共享

Dell服务器设置远程文件共享 用来加载iso文件,用于安装系统或者修复 输入172.18.31.2:/export/nfsshare/centos7-live-docker.iso 缺省是支持4种格式的共享: CIFS — //<IP to connect for CIFS file system>/<file path>/<image name> NFS — < IP to connect for NFS file system>:/<file path>/<image name> HTTP — http://<URL>/<file path>/<image name> HTTPs — https://<URL>/<file path>/<image name> 点击Connect 好的话,就会蹦出Success 然后启动虚拟控制台,Boot菜单选中启动:Virtual CD/DVD/ISO 重启,就可以进入centos7-live-docker.iso的系统了

2022年12月18日 · 1 分钟 · 42 字 · 八戒

Dell机器主板VLT0204故障处理以及内存插法

vlt0204, NDC瓦特超了,十有八九是网卡烧了,然后导致主板电压过载。 前面板日志:VLT0204,登录idrac看到日志: The system board NDC PG voltage is outside of range. 悲剧了,可能是主板烧了 处理方法如下: 一、主板放电 1、关机 2、拔电源线 3、长按电源开关半分钟不放手 4、半分钟后放手,接回电源线开机看看 如果以上方法不行,就必须采用第二种方法: 二、最小化负载排错 1、拔掉电源2 2、拔掉CPU2 3、拔掉所有内存(只留1条或2条) 4、拔掉网卡 5、启动看看 R740的内存插法: R730的内存插法:

2022年12月18日 · 1 分钟 · 29 字 · 八戒

升级CentOS7的kernel核心

CentOS7更新内核 内核下载地址:https://elrepo.org/linux/kernel/el7/x86_64/RPMS/ 内核包有两种,ml主流,lt长期支持。 我们升级核心肯定是为了主流的功能,lt还升它做甚。 #升级: rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-6.1.0-1.el7.elrepo.x86_64.rpm #查看可用内核 awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg #初始化第一个为默认内核 grub2-set-default 0 #重新创建内核配置 grub2-mkconfig -o /boot/grub2/grub.cfg reboot #后续有需要再装,不需要搞开发就别装! #更新kernel-ml-headers rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-headers-6.1.0-1.el7.elrepo.x86_64.rpm #更新kernel-ml-devel rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-devel-6.1.0-1.el7.elrepo.x86_64.rpm

2022年12月18日 · 1 分钟 · 37 字 · 八戒

合规要求之CentOS7的用户密码策略

各种合规要求中都对用户策略有着要求,什么PCI啊,上市审计啊,都有着密码复杂程度的要求: CentOS 7 的用户密码策略: 修改vi /etc/pam.d/system-auth 其中有一行: password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= 后面加上: minlen=12 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 enforce_for_root 修改成为: password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= minlen=12 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 enforce_for_root 意思是: 密码长度12,须包含:一个小写字符,一个大写字符,一个数字,一个特殊字符,强制root也遵守此规则 参数全部解释如下: retry=3: This option will prompt the user 3 times before exiting and returning an error. minlen=12: This specifies that the password cannot be less than 12 characters. maxrepeat=3: This allows implies that only a maximum of 3 repeated characters can be included in the password. ucredit=-1: The option requires at least one uppercase character in the password. lcredit=-1: The option requires at least one lowercase character in the password. dcredit=-1: This implies that the password should have at last a numeric character. ocredit=-1: The option requires at least one special character included in the password. difok=3: This implies that only a maximum of 3 character changes in the new password should be present in the old password. reject_username: The option rejects a password if it consists of the username either in its normal way or in reverse. enforce_for_root: This ensures that the password policies are adhered to even if it’s the root user configuring the passwords.

2022年12月18日 · 1 分钟 · 194 字 · 八戒

Dnsmasq配置一个域名对应多个ip

一:介绍: DNSMasq主要用来解决内网DNS域名缓存、DHCP、网络启动和路由通告功能,我们主要是将DNSMasq作为内网DNS域名劫持使用 系统环境:centos7.6 需求:一个域名对应多个ip 主机ip:(内网主机172.18.30.1和172.18.30.2) 二:配置方法 1,添加如下配置到/etc/dnsmasq.conf addn-hosts=/etc/ty.ddky.local addn-hosts:如果要支持一个域名对应多个 IP,就必须用 addn-hosts 选项 2,/etc/ty.ddky.local 文件内容如下: 172.18.33.100 ty.ddky.local 172.18.33.104 ty.ddky.local 3,修改完成后重启 DNSMasq systemctl restart dnsmasq.service

2022年12月18日 · 1 分钟 · 23 字 · 八戒

老版本cacti的图形filter突然失效的解决办法

网络工程师选择网络设备的监控工具是老牌的cacti,当然作为系统工程师的我,还是觉得librenms是个好选择,但是,librenms会对网络设备cpu造成比较大的压力。那还是遵从他的选择,最近网工报告说: 选择图形的时候时间Filter失效了。选择了以后图形无变化,崩溃,查了一下,都上古的玩意了。 修改方法: 修改graph_image.php unixtime = 1600000000,也就是到 2020-09-13 20:26:40。放大到 2600000000,也就是到2052-05-22 22:13:20,写这个php程序的人防越界,却没想到时间真的来到了这个节点。 注:Unix 时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒。

2022年12月18日 · 1 分钟 · 13 字 · 八戒

线上服务器出现多网关问题的处理

线上服务器172.18.30.67 有4个网口 其中eno1和eno2是两个光纤万兆口,enp26s0f0和enp26s0f1是两个以太千兆网口。 eno2网卡在没做bonding的时候,通过NetworkManager的dhcp获得了地址。然后eno1和eno2做了bonding,但是eno2实际还在单独起作用,bonding后地址没去掉,导致有两个网关。路由表如下: [root@renhe-18-30-67 ~]# ip r default via 172.18.29.254 dev eno2 default via 172.18.31.254 dev br0.199 proto static metric 426 172.18.28.0/23 dev eno2 proto kernel scope link src 172.18.28.67 172.18.30.0/23 dev br0.199 proto kernel scope link src 172.18.30.67 metric 426 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 eno2是从dhcp获得了172.18.28.67的地址 ip a eno2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 inet 172.18.28.67 netmask 255.255.254.0 broadcast 172.18.29.255 ether b4:05:5d:08:e0:d8 txqueuelen 1000 (Ethernet) RX packets 81768780 bytes 5398659503 (5.0 GiB) RX errors 0 dropped 7 overruns 0 frame 0 TX packets 10044620 bytes 467566304 (445.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 这种情况下,处理方法如下: ...

2022年12月18日 · 2 分钟 · 260 字 · 八戒

114dns的ttl超时的教训

114.114.114.114 这个DNS修改记录等待的生效时间非常的长,远远超出了TTL的时长,基本是你设置TTL时间的6倍。 这是上次我们割接得到的教训啊。我们要割接m.ddky.com的域名。 注:在修改m.ddky.com的记录前,已经把ddky.com的m.ddky.com的TTL改成了1分钟,正常的来说,第一轮1分钟内不更新,第二轮2分钟内也应该更新了。 看下图,在带外机上做的查询,查询的时候8.8.8.8和223.5.5.5都已经生效了,变成了帝联的地址。 06:06:57 做了查询,去掉小时,06:57定义为起始时间。 一直到 12:22 分还没有变过来,大概 13:00 变过来 起始 06:57 – 13:00 ,一共用了6分钟。而TTL是1分钟,所以基本是6倍时间。 往前推测5月25日的DNS割接,TTL是10分钟,6倍,就是60分钟,基本吻合。 如果想让DNS尽快生效,TTL改成10秒是极限了。

2022年12月18日 · 1 分钟 · 19 字 · 八戒