gpt4 book ai didi

docker - centos 7如何用docker 1.13版本更改docker安装目录

转载 作者:IT老高 更新时间:2023-10-28 12:45:36 29 4
gpt4 key购买 nike

我在下面附上了 docker 的详细信息,

$ docker 信息

Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 26
Server Version: 1.13.0
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.6.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.51 GiB
Name: docker
ID: WYAF:SDYL:LVAU:OKDP:O6K2:ZLG6:RMIB:SET4:SWGN:6TBR:ST6K:4W55
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

$ docker系统df

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images 4 3 4.441 GB -1.644e+09 B (-37%)
Containers 3 3 6.867 GB 0 B (0%)
Local Volumes 0 0 0 B 0 B

$ df -h

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root 14G 14G 647M 96% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 25M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 497M 216M 281M 44% /boot
/dev/sdb 296G 65M 281G 1% /mnt
overlay 14G 14G 647M 96% /var/lib/docker/overlay/dfa0c4e618c259bf046b454b27a7963fb31b9d4e95cc745ed28696b0791e3166/merged
shm 64M 0 64M 0% /var/lib/docker/containers/6e978cecc472322ef984cdb73117ed0243eb88c30d37c93827084bec88dcf15a/shm
overlay 14G 14G 647M 96% /var/lib/docker/overlay/9cdd3dc933f93febccaa7e06ba2f86023d3dd655614be5d9e636ab75f21873f4/merged
shm 64M 0 64M 0% /var/lib/docker/containers/ed44174945e331246f622e42a6ea646504075a91e4922168d895ed295cd24109/shm
overlay 14G 14G 647M 96% /var/lib/docker/overlay/c2bc2c73f0f3b0e717f8ea134aad8554ebb6b77c2dcfd85e8035a645bf75d074/merged
shm 64M 0 64M 0% /var/lib/docker/containers/26fd8e67dc7da80f6047add17aaddd7f67f763966d4a6b65d08680ac41774a28/shm
tmpfs 1.6G 0 1.6G 0% /run/user/0

我们可以看到根目录的空间被填满了,所以我想把docker安装目录挂载到/mnt。许多人建议包含 -g 选项,但它无法提供该选项。

谁能帮助我如何挂载到/mnt 目录以及在哪里进行这些更改。我正在使用 centos 7,我已经在下面的链接的帮助下安装了 docker,并且我遵循了完全相同的步骤,

https://docs.docker.com/engine/installation/linux/centos/

并按照此处提供的步骤 https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169

我在 /etc/sysconfig/etc/default 中找不到 docker 文件。请建议在哪里更改此设置

最佳答案

根据Docker Document推荐的方式是使用平台无关的daemon.json文件,Linux上默认位于/etc/docker/ .

daemon.json 文件中设置以下标志:

{
"data-root": "/mnt/docker-data",
"storage-driver": "overlay"
}

关于docker - centos 7如何用docker 1.13版本更改docker安装目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42279278/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com