记录一次docker扩容
搭建的harbor只有20G的磁盘空间,现在镜像多了,不够用了。
环境
[root@harbor harbor]#cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@harbor harbor]#docker version
Client: Docker Engine - CommunityVersion: 20.10.17API version: 1.40Go version: go1.17.11Git commit: 100c701Built: Mon Jun 6 23:05:12 2022OS/Arch: linux/amd64Context: defaultExperimental: trueServer: Docker Engine - CommunityEngine:Version: 19.03.15API version: 1.40 (minimum version 1.12)Go version: go1.13.15Git commit: 99e3ed8919Built: Sat Jan 30 03:16:33 2021OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.6.6GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1runc:Version: 1.1.2GitCommit: v1.1.2-0-ga916309docker-init:Version: 0.18.0GitCommit: fec3683
文件系统为xfs,未做LVM逻辑卷
虚拟机添加硬盘
启动虚拟机
停止harbor
[root@harbor harbor]#docker-compose stop
Stopping harbor-jobservice ... done
Stopping nginx ... done
Stopping harbor-core ... done
Stopping harbor-db ... done
Stopping harbor-portal ... done
Stopping redis ... done
Stopping registryctl ... done
Stopping registry ... done
Stopping harbor-log ... done
验证
[root@harbor harbor]#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
停止docker
[root@harbor harbor]#systemctl stop docker
[root@harbor harbor]#systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)Active: inactive (dead) since Fri 2022-07-22 03:42:52 GMT; 8s agoDocs: https://docs.docker.comProcess: 1104 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 10.0.0.81 (code=exited, status=0/SUCCESS)Main PID: 1104 (code=exited, status=0/SUCCESS)Jul 22 03:41:04 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:04.257780421Z" level=info msg="ignoring event" module=l...elete"
Jul 22 03:41:04 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:04.264381575Z" level=info msg="ignoring event" module=l...elete"
Jul 22 03:41:14 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:14.195026130Z" level=info msg="Container f534d045eb889c...force"
Jul 22 03:41:14 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:14.281973610Z" level=info msg="ignoring event" module=l...elete"
Jul 22 03:41:24 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:24.387055913Z" level=info msg="Container 78c276d0231065...force"
Jul 22 03:41:24 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:41:24.466741978Z" level=info msg="ignoring event" module=l...elete"
Jul 22 03:42:52 harbor.kktb.org systemd[1]: Stopping Docker Application Container Engine...
Jul 22 03:42:52 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:42:52.167317207Z" level=info msg="Processing signal 'terminated'"
Jul 22 03:42:52 harbor.kktb.org dockerd[1104]: time="2022-07-22T03:42:52.167770509Z" level=info msg="Daemon shutdown complete"
Jul 22 03:42:52 harbor.kktb.org systemd[1]: Stopped Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
创建新的挂载点
[root@harbor harbor]#mkdir -pv /data/sdb/docker/lib/
mkdir: created directory ‘/data/sdb’
mkdir: created directory ‘/data/sdb/docker’
mkdir: created directory ‘/data/sdb/docker/lib/’
硬盘分区,格式化
[root@harbor harbor]#fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xbac63495.Command (m for help): n
Partition type:p primary (0 primary, 0 extended, 4 free)e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is setCommand (m for help): w
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.[root@harbor harbor]#mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6553536 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=26214144, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=12799, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
挂载硬盘
[root@harbor harbor]#mount /dev/sdb1 /data/sdb/docker/lib/
移动数据
[root@harbor harbor]#mv /var/lib/docker/* /data/sdb/docker/lib/[root@harbor ~]#ll /data/sdb/docker/lib/
total 16
drwx------ 2 root root 24 Jul 15 12:32 builder
drwx--x--x 4 root root 139 Jul 15 12:32 buildkit
drwx-----x 5 root root 222 Jul 22 03:57 containers
drwx------ 3 root root 22 Jul 15 12:10 image
drwxr-x--- 3 root root 19 Jul 15 12:10 network
drwx-----x 102 root root 8192 Jul 22 03:57 overlay2
drwx------ 4 root root 32 Jul 15 12:10 plugins
drwx------ 2 root root 6 Jul 22 03:57 runtimes
drwx------ 2 root root 6 Jul 15 12:10 swarm
drwx------ 2 root root 6 Jul 22 03:57 tmp
drwx------ 2 root root 6 Jul 15 12:10 trust
drwx-----x 20 root root 4096 Jul 18 02:01 volumes
更改docker服务启动参数
[root@harbor harbor]#grep root /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 10.0.0.81 --data-root=/data/sdb/docker/lib
重新加载服务
[root@harbor ~]#systemctl daemon-reload
[root@harbor ~]#systemctl start docker
docker info 验证
[root@harbor ~]#docker info
Client:Context: defaultDebug Mode: falsePlugins:app: Docker App (Docker Inc., v0.9.1-beta3)buildx: Docker Buildx (Docker Inc., v0.8.2-docker)scan: Docker Scan (Docker Inc., v0.17.0)Server:Containers: 3Running: 0Paused: 0Stopped: 3Images: 15Server Version: 19.03.15Storage Driver: overlay2Backing Filesystem: xfsSupports d_type: trueNative Overlay Diff: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins:Volume: localNetwork: bridge host ipvlan macvlan null overlayLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1runc version: v1.1.2-0-ga916309init version: fec3683Security Options:seccompProfile: defaultKernel Version: 3.10.0-1160.el7.x86_64Operating System: CentOS Linux 7 (Core)OSType: linuxArchitecture: x86_64CPUs: 4Total Memory: 1.777GiBName: harbor.kktb.orgID: BKNU:DFRK:LAIX:NNNP:Q7OV:T32C:A2F3:3ACG:UR6C:GQ3I:RCOU:T7ZVDocker Root Dir: /data/sdb/docker/lib # root dir数据目录已经更改Debug Mode: falseUsername: kktbzhaoRegistry: https://index.docker.io/v1/Labels:Experimental: falseInsecure Registries:10.0.0.81127.0.0.0/8Registry Mirrors:https://itg4y4qm.mirror.aliyuncs.com/Live Restore Enabled: false
验证镜像都存在
[root@harbor ~]#docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
goharbor/harbor-exporter v2.3.0 fa4ecf260b3a 13 months ago 80.7MB
goharbor/chartmuseum-photon v2.3.0 199be7eb1b5b 13 months ago 178MB
goharbor/redis-photon v2.3.0 3cc2c3e315a2 13 months ago 191MB
goharbor/trivy-adapter-photon v2.3.0 3c3dc5fc0529 13 months ago 164MB
goharbor/notary-server-photon v2.3.0 a8e3a26ef25a 13 months ago 105MB
goharbor/notary-signer-photon v2.3.0 e8776cc92436 13 months ago 102MB
goharbor/harbor-registryctl v2.3.0 4cf0d9bc3086 13 months ago 132MB
goharbor/registry-photon v2.3.0 222f05a9ab07 13 months ago 81MB
goharbor/nginx-photon v2.3.0 78f6ae7adc04 13 months ago 44MB
goharbor/harbor-log v2.3.0 9446a5b39706 13 months ago 194MB
goharbor/harbor-jobservice v2.3.0 bac328ac1a47 13 months ago 170MB
goharbor/harbor-core v2.3.0 7bbebce7798c 13 months ago 157MB
goharbor/harbor-portal v2.3.0 c4f22964cbf3 13 months ago 57.3MB
goharbor/harbor-db v2.3.0 fc74663d9e30 13 months ago 262MB
goharbor/prepare v2.3.0 a830321ca695 13 months ago 291MB
磁盘使用率
[root@harbor ~]#df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 900M 0 900M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.6M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda2 xfs 15G 5.2G 9.9G 35% /
/dev/sda1 xfs 1014M 142M 872M 15% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/0
/dev/sdb1 xfs 100G 1.9G 99G 2% /data/sdb/docker/lib
重新启动harbor
[root@harbor harbor]#docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registry ... done
Creating harbor-db ... done
Creating redis ... done
Creating harbor-portal ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
端口
[root@harbor harbor]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 127.0.0.1:1514 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
LISTEN 0 128 [::]:443 [::]:*
LISTEN 0 128 [::]:80 [::]:*
设置/dev/sdb
开机自动挂载
[root@harbor harbor]#tail /etc/fstab
# /etc/fstab
# Created by anaconda on Tue Jan 25 16:07:26 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=cf703e39-714d-4bda-9dc2-8f6737bfed60 / xfs defaults 0 0
UUID=1fc09a8d-481b-4975-8107-542aa1db0f83 /boot xfs defaults 0 0
UUID=e83936b9-4ae8-4240-ac49-38686976ce98 swap swap defaults 0 0
/dev/sdb1 /data/sdb/docker/lib xfs defaults 0 0
web访问
记录一次docker扩容相关推荐
- 记录一次docker导致宿主机重启故障解决方法
记录一次docker导致宿主机重启故障解决方法 参考文章: (1)记录一次docker导致宿主机重启故障解决方法 (2)https://www.cnblogs.com/caidingyu/p/1215 ...
- Unraid使用记录:使用Docker与虚拟机
文章目录 前言 使用Docker 使用示例 相关说明 使用虚拟机 使用示例 相关说明 硬件直通 后记 前言 Unraid本身功能挺少的,很多功能都是要通过插件.Docker和虚拟机来实现的.Docke ...
- 记录一次docker部署tomcat安装GBK字体,容器系统Debian GNU/Linux
记录一次docker部署tomcat安装GBK字体 docker版本号为:Docker version 20.10.6, build 370c289 下载的官方镜像: tomcat:8.5.32 to ...
- Docker 扩容 容器空间大小 - 九
Docker 扩容: 提前规划 : 一是从宿主机 配置磁盘格式 LVM 宿主机可以动态扩展: 二是 在容器上的扩容:默认是 100G .然后创建容器时候 挂载目录 或者直接池扩展: 默认 Docker ...
- 记录win7安装Docker for Windows(DockerToolbox)的一记大坑:wating for an ip....卡死
操作系统:windows7 x64 软件:Docker For Windows的DockerToolbox 问题: 按照提示安装完成后,首次运行Docker Quickstart Terminal即画 ...
- Docker扩容:Centos8虚拟机硬盘扩容+修改Docker默认存储位置
实验目的: Docker所存储的位置已经使用了百分之百,无法满足后续的运行需要.并且目前VMware虚拟机存在快照,不能对已有的硬盘直接扩容. 目前需要完成的是在Centos8虚拟机上的其他目录挂载新 ...
- 记录一次Docker For Windows10镜像加速器配置
1.访问https://www.daocloud.io 注册账号 2.访问资源->加速器,或者直接访问网址https://www.daocloud.io/mirror,页面中间有加速配置,例如我 ...
- 【MySQL】记录 Navicat连接 docker mysql 容器,备份docker mysql 注意事项
文章目录 Navicat连接 docker mysql 容器 定时任务备份 docker mysql ,解决 备份数据库为空 问题 Navicat连接 docker mysql 容器 确保 登录 用户 ...
- 记录一次docker项目连接不上docker mysql的问题
异常如下: CommunicationsException: Communications link failure The last packet sent successfully to the ...
最新文章
- linux安装64 mysql5.7_Linux安装64位Mysql5.7.22
- 《系统分析与设计方法》 第8章 数据建模
- OpenStack高可用核心架构分析
- sql 分类汇总 列_分类汇总哪家强?R、Python、SAS、SQL?
- python数据整理代码_熬夜整理的资料:分享Python数据可视化图表代码和案例给大家...
- 2019年十大AI创业死亡名单:无人车机器人为主,B轮阵亡最多
- Linux小工具(4)之apt软件管理
- 中小型互联网公司微服务实践-经验和教训
- 用VS向SharePoint中部署添加List 并指定应用的Content Type
- 阿里搜索技术,在AI路上走了多远?
- 操作系统实验报告2:Linux 下 x86 汇编语言1
- windows Server 2008+iis 7.5 部署应用程序
- numpy教程:排序、搜索和计数
- (个人)Linux基本指令收集
- java内存分配与回收策略、动态对象年龄判断、空间分配担保
- 电路设计中的防爆设计原理与注意事项分析
- 思科模拟器路由表怎么看_实战思科 Cisco 模拟器 Packet tracer 使用教程详解.pdf
- 模拟退火算法(SA)
- gis连接表格到数据库失败_ArcGIS添加Excel数据的新老问题(连接数据库失败)
- 1055 mysql_mysql8.0.1 报错1055
热门文章
- 【原创】Python脚本新浪微博群抢早鸟+夜猫(2023.7.5可用)
- java 反射教程_Java基础教程——反射机制
- 老鱼Python数据分析——篇十八:消息推送(一)
- 有容乃大-----C语言
- 【python ACM 输入输出的处理:sys.stdin.readline().strip().split())】
- j2me(javame)开发找不到MIDlet类。请检查jad文件或用—MIDLET参数指定解决方案
- Easyui初步学习
- DOS命令:ftype
- 南卡和索尼蓝牙耳机哪个好?两款高性价比音质蓝牙耳机对比测评
- VOR/DME进近与ILS进近的不同之处(摘录转载feeyo.com)