docker安装(centos7)
1.确定自己所在的系统是centos7及以上:cat /etc/redhat-release
2.确保centos7所在的机器能上外网
3.yum安装gcc相关:3.1 yum -y install gcc 3.2 yum -y install gcc-c++
4.卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
5.安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
6.设置stable镜像仓库
千万不要写这个:yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
要写这个:yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
7.更新yum软件包索引
yum makecache fast
8.安装DOCKER CE
yum -y install docker-ce
9.启动docker
systemctl start docker
10.测试
docker version
docker run hello-world
11.配置镜像加速
mkdir -p /etc/docker
vim /etc/docker/daemon.json
这个daemon.json里面的内容为:
{ "registry-mirrors": ["https://t6ljgmyd.mirror.aliyuncs.com"] }
systemctl daemon-reload
systemctl restart docker