02 docker installation

Docker official website: https://www.docker.com/
docker mirror library: https://hub.docker.com/

For the installation of Docker CE (community free version), please refer to the official documentation:
● MacOS: https://docs.docker.com/docker-for-mac/install/
● Windows: https://docs.docker.com/docker- for-windows/install/
● Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/
● Debian: https://docs.docker.com/install/linux/docker-ce/ debian/
● CentOS7: https://docs.docker.com/install/linux/docker-ce/centos/
● Fedora: https://docs.docker.com/install/linux/docker-ce/fedora/
● Others Linux distributions: https://docs.docker.com/install/linux/docker-ce/binaries/

CenterOS installation

Install using a remote mirror warehouse

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Set up yum remote warehouse

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.
执行如下命令:

$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

After the execution is complete, you can see the mirror warehouse source in the /etc/yum.repos.d directory

Step 2: Install docker

#Download and install the latest version [not recommended]
#yum install docker-ce docker-ce-cli containerd.io -y

#Download and install the specified version [suggestion]
#Check docker-ce version - ensure that the server can connect to the external network
yum list docker-ce --showduplicates | sort -r

Install

yum install docker-ce-18.09.0 docker-ce-cli-18.09.0 containerd.io -y

#View docker version
docker -v

#Start Docker
systemctl start docker
systemctl stop docker
systemctl restart docker

#Set boot autostart
systemctl enable docker

Step 3: docker image accelerator

After installing Docker, we can download a large number of containerized application images from Docker Hub, which is ready to use. Some of these images are officially maintained by Docker, and more are uploaded and shared by many developers.
Unfortunately, Docker Hub does not deploy servers in China or use domestic CDN services. Therefore, under the special network environment in China, Mirror image download is very time-consuming, ranging from 20 minutes to dozens of hours.
Configure Ali Mirror Accelerator: Enter Alibaba Cloud to view the mirror
insert image description here
insert image description here

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://lt52fxsd.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

View the mirror source used:

debian/Ubuntu installation

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Guess you like

Origin blog.csdn.net/qq_41709801/article/details/127338987