20210322-docker_2安装

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值