・システム領域のハードディスクを大量に消費するので、別ディレクトリへ引っ越しする
以下の例は、/var/lib/docker から /xxx/mnt/docker/ へ引越し
0.初期設定確認
1.ServiceSTOP
2.ディレクトリを作ってコピー
3.設定変更
4.ServiceStart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 0.初期状態確認 | |
$ docker info | grep 'Docker Root Dir' | |
Docker Root Dir: /var/lib/docker | |
##RHEL7+Docker-CEの場合の設定ファイルを見ると、”dockerd” | |
##本設定は、dockerd の場合有効です。 | |
$ sudo cat /usr/lib/systemd/system/docker.service | |
[sudo] xxxxのパスワード: | |
[Unit] | |
Description=Docker Application Container Engine | |
Documentation=https://docs.docker.com | |
After=network-online.target firewalld.service | |
Wants=network-online.target | |
[Service] | |
Type=notify | |
# the default is not to use systemd for cgroups because the delegate issues still | |
# exists and systemd currently does not support the cgroup feature set required | |
# for containers run by docker | |
ExecStart=/usr/bin/dockerd | |
ExecReload=/bin/kill -s HUP $MAINPID | |
# Having non-zero Limit*s causes performance problems due to accounting overhead | |
# in the kernel. We recommend using cgroups to do container-local accounting. | |
LimitNOFILE=infinity | |
LimitNPROC=infinity | |
LimitCORE=infinity | |
# Uncomment TasksMax if your systemd version supports it. | |
# Only systemd 226 and above support this version. | |
#TasksMax=infinity | |
TimeoutStartSec=0 | |
# set delegate yes so that systemd does not reset the cgroups of docker containers | |
Delegate=yes | |
# kill only the docker process, not all processes in the cgroup | |
KillMode=process | |
# restart the docker process if it exits prematurely | |
Restart=on-failure | |
StartLimitBurst=3 | |
StartLimitInterval=60s | |
[Install] | |
WantedBy=multi-user.target | |
## 1.Service Stop ー Docker の停止 | |
$ sudo service docker stop | |
Redirecting to /bin/systemctl stop docker.service | |
## 2.ディレクトリを作ってコピー | |
$ sudo mkdir /xxx/mnt/docker | |
$ sudo cp -r /var/lib/docker /xxx/mnt/docker | |
## 3.設定変更 - 設定ファイルを作成する | |
$ cd /etc/docker/ ##これが設定ファイル置き場。Jsonで置くらしい | |
$ ls | |
key.json | |
##ここに、daemon.jsonを作る | |
$ vi daemon.json | |
{ | |
"graph": "/xxx/mnt/docker" | |
} | |
~ | |
~ | |
~ | |
## 以下のように作成される。 | |
$ ls | |
daemon.json key.json | |
##4. Service Start | |
$ sudo service docker start | |
Redirecting to /bin/systemctl start docker.service | |
## Root Directoryが変更されているので成功!! | |
$ docker info | grep 'Docker Root Dir' | |
Docker Root Dir: /xxx/mnt/docker | |
$ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
httpd latest 7239615c0645 7 weeks ago 177MB |
0 件のコメント:
コメントを投稿