目录
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