Docker 설치하기#

https://docs.docker.com/install/linux/docker-ce/centos/#install-using-the-convenience-script

# install docker in centos 7.x
[root@fromm01 ~]# curl -fsSL https://get.docker.com -o get-docker.sh
[root@fromm01 ~]# sh get-docker.sh
[root@fromm01 ~]# usermod -aG docker fromm0
[root@fromm01 ~]# systemctl restart docker 
# [root@fromm01 ~]# service docker restart

Docker root 디렉토리 변경하기 #

/var 아래 공간이 부족한 경우

"Option 1 - Direct edit to docker.service" https://github.com/IronicBadger/til/blob/master/docker/change-docker-root.md

# create docker root directory
[fromm0@fromm01 ~]$ mkdir -p temp/docker_root
 
# check current docker root directory
[fromm0@fromm01 ~]$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since 목 2019-03-28 16:35:40 KST; 19h ago
     Docs: https://docs.docker.com
 Main PID: 142103 (dockerd)
    Tasks: 24
   Memory: 34.5M
   CGroup: /system.slice/docker.service
           ├─142103 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /home/fromm0/temp/docker
           └─155121 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.2 -container-port 9000
 
# change docker root
[root@fromm01 ~]# vi /usr/lib/systemd/system/docker.service

아래와 같이 ExecStart에 -g /home/fromm0/temp/docker_root 옵션 추가

[Service]
ExecStart=/usr/bin/dockerd -g /home/fromm0/temp/docker_root -H unix://

재시작 및 확인

[root@fromm01 ~]# systemctl daemon-reload
[root@fromm01 ~]# systemctl restart docker
[root@fromm01 ~]# docker info | grep Root
Docker Root Dir: /var/lib/docker

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 14-Feb-2020 10:45 by DongGukLee