centos 7 安装 docker(详细)

本文详细介绍在CentOS系统上安装Docker-ce的过程,包括更新系统、安装Docker、启动服务、测试运行hello-world镜像及配置Docker加速器的方法。同时解决Docker守护进程连接失败的问题。

更新源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

更新系统

yum update

更新yum && 安装tools

yum update && yum install -y vim python-pip curl git

更新 yum 缓存:

sudo yum makecache fast

安装 Docker-ce:

sudo yum -y install docker-ce

启动 Docker 后台服务

sudo systemctl start docker

测试运行 hello-world

docker pull hello-world

docker run hello-world

docker加速器

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://88bbf89e.m.daocloud.io

//需要重启
systemctl restart docker  

若报错Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

解决办法
$ systemctl daemon-reload
$ sudo service docker restart
$ sudo service docker status (should see active (running))
$ sudo docker run hello-world

转载于:https://www.cnblogs.com/somliy/p/10279649.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值