Linux中docker容器的安装

1.查看当前内核版本>=3.10
uname -r
2.更新yum包
yum update
3.卸载旧版本
yum remove docker docker-common docker-selinux docker-engine
4.安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
5.设置yum源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6.运行yum makecache生成缓存
yum clean all
yum makecache
7.安装docker
yum install docker-ce
8.启动docker并加入开机自启
systemctl start docker
systemctl enable docker
9.验证是否成功
docker version

配置镜像加速器
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
刷新daemon并重启docker
systemctl daemon-reload
systemctl restart docker

相关推荐