簡單粗暴的八步安裝docker

目錄

1.環境查看

2.卸載舊版本的docker

 3.下載需要的安裝包

4.設置鏡像倉庫

 5.安裝docker引擎。

6.啓動docker

7.查看docker是否安裝成功

 8.運行hello-world鏡像


1.環境查看

#查看內核 內核是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.卸載舊版本的docker

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

 3.下載需要的安裝包

yum install -y yum-utils

4.設置鏡像倉庫

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

推薦改成阿里雲的

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

 5.安裝docker引擎。注意:在安裝前更新一下yum軟件包的索引

yum makecache fast

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

6.啓動docker

systemctl start docker

 

7.查看docker是否安裝成功

docker version

 

 8.運行hello-world鏡像

docker run hello-world

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章