centos 7 安装 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

猜你喜欢

转载自www.cnblogs.com/somliy/p/10279649.html