docker默认路径存储不足解决过程
作者:可问春风
这篇文章主要给大家介绍了关于docker默认路径存储不足的解决过程,Docker存储空间不足的错误通常表明Docker Daemon分配的本地磁盘空间用尽,文中通过代码将解决的办法介绍的非常详细,需要的朋友可以参考下
docker的默认路径存储不足
添加磁盘
[root@localhost ~]# fdisk -l 磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x00095d44 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 83886079 40893440 8e Linux LVM 磁盘 /dev/sdb:107.4 GB, 107374182400 字节,209715200 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-root:39.7 GB, 39720058880 字节,77578240 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 [root@localhost ~]# fdisk /dev/sdb 欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 Device does not contain a recognized partition table 使用磁盘标识符 0xcaf2ac7e 创建新的 DOS 磁盘标签。 命令(输入 m 获取帮助):g Building a new GPT disklabel (GUID: 60063BE6-D393-4582-AEEB-C98087007C13) 命令(输入 m 获取帮助):n 分区号 (1-128,默认 1): 第一个扇区 (2048-209715166,默认 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-209715166,默认 209715166): 已创建分区 1 命令(输入 m 获取帮助):w The partition table has been altered! Calling ioctl() to re-read partition table. 正在同步磁盘。 #格式化磁盘 [root@localhost ~]# mkfs -t xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6553535 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=26214139, 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@localhost ~]# mount -t xfs /dev/sdb1 /data
永久写入磁盘
[root@localhost ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Tue Nov 22 19:08:23 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 # /dev/mapper/centos-root / xfs defaults 0 0 UUID=6638d2be-bc05-4ab2-bc32-d1ae3234d408 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 UUID=adc0d342-853c-4f5a-b5ff-d8dc65ec9705 /data xfs defaults 0 0
[root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 898M 0 898M 0% /dev tmpfs 910M 0 910M 0% /dev/shm tmpfs 910M 9.5M 901M 2% /run tmpfs 910M 0 910M 0% /sys/fs/cgroup /dev/mapper/centos-root 37G 32G 5.4G 86% / /dev/sda1 1014M 151M 864M 15% /boot tmpfs 182M 0 182M 0% /run/user/0 /dev/sdb1 100G 33M 100G 1% /data
迁移docker数据
[root@localhost ~]# systemctl stop docker Warning: Stopping docker.service, but it can still be activated by: docker.socket [root@localhost ~]# systemctl stop docker.socket [root@localhost ~]# [root@localhost ~]# mkdir /data/docker 同步docker镜像数据 nohup rsync -avz /var/lib/docker/ /data/docker/ & cp -r /var/lib/docker/ /data/docker/ 编辑/etc/docker/daemon.json,添加参数,将docker的目录迁移绑定 "data-root ": "/data/docker" [root@localhost ~]# systemctl restart docker
graph 1.17以前
–data-root 1.17以后
[root@localhost ~]# docker info Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Build with BuildKit (Docker Inc., v0.6.3-docker) scan: Docker Scan (Docker Inc., v0.23.0) Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 265 Server Version: 20.10.9 Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux Default Runtime: runc Init Binary: docker-init containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc version: v1.1.12-0-g51d5e94 init version: de40ad0 Security Options: seccomp Profile: default Kernel Version: 3.10.0-1160.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.777GiB Name: localhost.localdomain ID: V2R4:D3LK:M35M:NUSH:PCXP:XSBF:O5RF:YSHX:ZOMV:RC4G:3DFJ:6J3Q Docker Root Dir: /data/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 192.168.12.97 39.156.86.16:50000 harbor.inspur.local nexus.inspur.local registry.cn-beijing.aliyuncs.com registry.cn-hangzhou.aliyuncs.com 10.110.63.67 127.0.0.0/8 Registry Mirrors: https://38ov96r5.mirror.aliyuncs.com/ Live Restore Enabled: false
总结
到此这篇关于docker默认路径存储不足解决的文章就介绍到这了,更多相关docker默认路径存储不足内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!