Simple and rude eight steps to install docker

table of Contents

1. Environment view

2. Uninstall the old version of docker

 3. Download the required installation package

4. Set up the mirror warehouse

 5. Install the docker engine.

6. Start docker

7. Check if docker is installed successfully

 8. Run the hello-world image


1. Environment view

#查看内核 内核是3.10及以上
uname -r

[root@localhost mengming]# uname -r
3.10.0-1062.el7.x86_64
# 系统版本centos7及以上
cat /etc/os-release 
[root@localhost mengming]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2. Uninstall the old version of docker

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

 3. Download the required installation package

yum install -y yum-utils

4. Set up the mirror warehouse

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo #默认是国外的

Recommend to change to Alibaba Cloud

yum-config-manager \
     --add-repo \
     http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 5. Install the docker engine. Note: Update the index of yum package before installation

yum makecache fast

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

6. Start docker

systemctl start docker

 

7. Check if docker is installed successfully

docker version

 

 8. Run the hello-world image

docker run hello-world

 

Guess you like

Origin blog.csdn.net/qq_31702609/article/details/106243538