如何使用docker 1.13版本更改centos 7中的docker安装目录

前端之家收集整理的这篇文章主要介绍了如何使用docker 1.13版本更改centos 7中的docker安装目录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在下面附上了码头工人的详细信息,

$docker info

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 system 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文件.请建议在哪里更改

Centos 7使用systemd,因此您可以在/etc/systemd/system/docker.service.d/override.conf中创建一个覆盖文件,该文件指定在启动时传递给dockerd的备用命令标志,以便使用/ var以外的目录/ lib / docker用于容器存储:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph=/mnt/docker-data --storage-driver=overlay

另一种选择是直接在/ var / lib / docker上挂载/ mnt处安装的磁盘.

进一步的细节在official docs.

猜你在找的Docker相关文章