该系列文章,大部分参考书籍《Learn.Docker.Fundamentals.of.Docker.18.x》,写这些文章主要用来实际操作一番,并记录相关的过程,方便自己以后查询。
系统环境:
操作系统:CentOS Linux release 7.5.1804 (Core)
内核版本:3.10.0-862.14.4.el7.x86_64
卸载历史版本(如果有的话)
yum remove docker docker-common docker-selinux docker-engine
安装依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
增加一个国内的docker yum仓库
官方仓库速度慢或者连不上,这里使用中科大的仓库
yum-config-manager \
--add-repo \
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
安装主程序
以下命令将安装最新稳定版
yum install -y docker-ce
设置为国内加速源
指定docker拉取镜像时使用的仓库,官方速度慢
创建docker配置目录
mkdir /etc/docker
创建相关配置文件
cat >> /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
EOF
启动服务
添加随机启动
systemctl enable docker
开启服务
systemctl start docker
查看版本信息
docker version
简单测试
docker container run hello-world
显示如下,则代表正常:

网友评论