Install Docker container under Linux

1. Introduction

Docker is an open source commercial product with two versions: Community Edition (Community Edition, abbreviated as CE) and Enterprise Edition (Enterprise Edition, abbreviated as EE). The enterprise version includes some paid services, which are generally not used by individual developers. The following introductions are all for the community edition.
For the installation of Docker CE, please refer to the official documentation. Here we take CentOS as an example:
Docker requires the kernel version of the CentOS system to be higher than 3.10, and the linux kernel version check command: uname -r

2. Installation

2.1 Uninstall the old version

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine \
                  docker-ce

2.2 Install the yum tool

Install the yum tool

yum install -y yum-utils \
           device-mapper-persistent-data \
           lvm2 --skip-broken

Update the local mirror source

yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

yum makecache fast

2.3 install docker

yum install -y docker-ce

2.4 Configure mirror acceleration

For users whose Docker client version is greater than 1.10.0 official
tutorial You can use the accelerator by modifying the daemon configuration file /etc/docker/daemon.json

sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://【yoursID】.mirror.aliyuncs.com"]
}
EOF

sudo systemctl daemon-reload

sudo systemctl restart docker

Guess you like

Origin blog.csdn.net/hu4545/article/details/128026319