티스토리 뷰

Linux

Docker Data Folder Configuration

uthline 2020. 1. 17. 07:26
반응형

How To Change Docker Data Folder Configuration

https://medium.com/@ibrahimgunduz34/how-to-change-docker-data-folder-configuration-33d372669056
docker의 data가 /에 쌓이게되면 용량문제가 있다.
용량이 풍부한 HDD(/home/)으로 경로를 변경하는 방법이다.

아래 파일 수정.
/usr/lib/systemd/system/docker.service

AS-IS

[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 -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

TO-BE

[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 -H fd:// --containerd=/run/containerd/containerd.sock $DOCKER_OPTS
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

데몬.config 수정

$ cat /etc/docker/daemon.json
{
  "data-root": "/home/uthline/docker"
}

mkdir

/home/uthline/docker

docker restart

sudo systemctl restart docker

Etc.

최근 docker 13.1에서는 위와 같은 방법으로 data-root가 변경되지 않은 것을 확인하였다. 그럴땐 아래와 같은 방법으로 시도해보시길...

sudo vi /etc/sysconfig/docker

AS-IS

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.

TO-BE

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --graph=/home/irteamsu/docker'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.
반응형

'Linux' 카테고리의 다른 글

Let’s Encrypt로 SSL 사이트로 변경  (0) 2018.12.06
du - disk 사용량 확인  (0) 2018.02.26
shell prompt 변경하기  (0) 2018.02.25
자주 사용하는 archiving, compressing 명령어  (0) 2018.02.19
HDD추가  (0) 2015.02.21
Cherrymusic compact view  (2) 2014.08.29
arp와 mac정보를 이용한 접속장비 확인  (0) 2014.07.22
ssh가 동작하지 않을때  (0) 2014.06.12
03-29 19:08
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함