Modify the default storage address of the docker image

One, install docker

Step1: Check whether the installation environment meets the docker installation requirements

Check whether the kernel kernel is above 3.10 : ~$ uname -a
Linux dlserver 4.15.0-33-generic #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

检查Device Mapper:~$ sudo grep device-mapper /proc/devices

253 device-mapper

Step2: Make sure that apt can use https and the CA certificate has been installed

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

Step3: Uninstall the old version that may exist

sudo apt-get remove docker docker-engine docker-ce docker.io

Step4: Add Docker official gpg key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Step5: Set up stable repository

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Step6: Update apt

sudo apt-get update

Step7: Check the docker version, install the specified version or the latest version

apt-cache madison docker-ce

 

Install the specified version

sudo apt-get install -y docker-ce=version number

Install the latest version

sudo apt-get install -y docker-ce

Two, modify the default storage path of docker

Step1: Stop the docker service: sudo service docker stop

Step2: Edit the file docker-overlay.conf 

cd  /etc/systemd/system/docker.service.d Create this path if there is no docker.service.d

sudo vim docker-overlay.conf If not, create this file

Add something to the file, save and exit

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph="New storage path" --storage-driver=overlay

Step3: restart docker

systemctl daemon-reload

sudo service docker start

Step4: Check the docker information to confirm whether the modification is successful

sudo docker info

Guess you like

Origin blog.csdn.net/yxpandjay/article/details/109244604