2-1、CentOS 6.8安装docker-io
2-1-1、yum install -y epel-release
2-1-2、yum install -y docker-io
2-1-3、安装后的配置文件:/etc/sysconfig/docker
2-1-4、启动docker后台服务:service docker start
2-1-5、测试
docker version
docker run hello-world(没有会从仓库pull)
2-1-6、阿里云镜像加速
1、地址:https://f80y183g.mirror.aliyuncs.com
2、在/etc/sysconfig/docker里配置:
other_args="--registry-mirror=https://f80y183g.mirror.aliyuncs.com"
2-2、CentOS 7安装docker-ce
2-2-1、官网安装手册
英文:https://docs.docker.com/engine/install/centos/
中文:https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#prerequisites
2-2-2、确定你是CentOS7及以上版本
cat /etc/redhat-release
2-2-3、yum安装gcc相关
1、CentOS7能上外网
2、yum -y install gcc
3、yum -y install gcc-c++
2-2-4、卸载旧版本
参考官网:Uninstall old versions
2-2-5、安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
2-2-6、设置stable镜像仓库
1、大坑:sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
2、推荐:sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2-2-7、更新yum软件包索引
yum makecache fast
2-2-8、安装docker-ce
yum -y install docker-ce
2-2-9、启动docker
systemctl start docker
2-2-10、测试
docker version
docker run hello-world(没有会从仓库pull)
2-2-11、配置镜像加速
1、mkdir -p /etc/docker
2、vim /etc/docker/daemon.json
{"registry-mirrors": ["https://f80y183g.mirror.aliyuncs.com"]}
3、systemctl daemon-reload
4、systemctl restart docker
2-2-12、卸载
1、systemctl stop docker
2、yum -y remove docker-ce
3、rm -rf /var/lib/docker