一 切换到root用户
二 执行以下命令
1:
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2:
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3:
yum-config-manager --enable docker-ce-nightly
4:
yum-config-manager --enable docker-ce-test
5:直接安装最新版
yum install docker-ce
6 启动Docker:
systemctl start docker
7 查看是否安装成功:
docker version
8 配置阿里云镜像加速器,国外网站下载镜像很慢:
8.1 登录阿里云官网:
https://www.aliyun.com/
8.2 使用淘宝账号或注册账户进行登录
8.3 登录后搜索 镜像加速器
8.4
8.5 粘贴并执行命令:
三 Docker入门
1 Docker Hello World:
运行:
docker run hello-world
由于本地没有hello-world这个镜像,所以会下载一个hello-world 镜像,并在容器内运行
2 docker run hello-world运行流程: