How to change the docker installation directory on centos 7 with docker version 1.13

I added docker details,

$ 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 

As we can see, the space in the root directory is full, so I would like to set the docker installation directory in /mnt . Many suggested including the -g option, but I could not provide this option.

Can someone help me how to connect to the / mnt directory and where to make these changes. I am using centos 7 and I installed docker using the link below and I followed exactly the same steps

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

And follow the steps given here https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169

I could not find the docker file in /etc/sysconfig or in /etc/default . Please suggest where to change this.

+5
source share
1 answer

Centos 7 uses systemd, so you can create an override file in /etc/systemd/system/docker.service.d/override.conf that specifies alternative command flags to go to dockerd at startup to use the directory to store your container. other than /var/lib/docker :

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

Another option is to install the hard drive installed on /mnt to /var/lib/docker directly.

More information is in the official docs .

+7
source

Source: https://habr.com/ru/post/1264307/


All Articles