环境准备
1、需要有Linux的基础
2、centOS 7
环境查看
# 系统内核是 3.10 以上的
[root@iz2zeaet7s13lfkc8r3e2kz ~]# uname -r
3.10.-1062.18..el7.x86_64
# 系统版本
[root@iz2zeaet7s13lfkc8r3e2kz ~]# 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"
安装
官方文档: https://docs.docker.com/engine/install/centos/
# 如果有就先卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine# 需要的安装包
yum install -y yum-utils# 设置镜像仓库 默认是从国外的!
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
#更新yum软件包索引
yum makecache fast
# 安装 docker-ce 社区版 ee企业版 官方推荐ce
yum install docker-ce docker-ce-cli containerd.io
# 启动
systemctl start docker
输入 docker version 查看版本信息
测试hello world
docker run hello-world
查看镜像 docker images
阿里云镜像加速
登录阿里云找到 容器镜像服务
分4步执行,执行完就ok了