在VMware软件中CenOS 7磁盘中安装docker

1.我用的是远程连接FinalShell远程连接软件,连接到VMware中的CenOS中

2.查看是否做好基础环境

vim /etc/selinux/config

看是否是SELINUX=disabled,如果不是,就改成disabled

关闭防火墙并查看是否关闭;清空本地规则;

systemctl stop firewalld

getenforce 0

iptables -F

3.安装阿里云镜像(安装过的就当更新)

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

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

4.清楚本地缓存生成新的缓存(出现“元数据缓存已建立”表示成功)

yum clean all && yum makecache

如果出现睡眠中的情况,断开连接,然后重启,重新执行yum clean all && yum makeacahe命令

reboot

如果重启了,再执行一次关闭防火墙的命令(getenforce stop firewalld),一定保证防火墙是关闭的。

5.基础做完后,我们开始配置网卡

cat <<EOF >  /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.ip_forward=1
EOF

把上面的全部复制到命令里,然后回车。

6.重新加载内核参数

sysctl -p /etc/sysctl.d/docker.conf

会报错,然后执行下面的命令

modprobe br_netfilter

然后再执行一次

7.下载阿里源repo文件(看好!!!这是两条命令分别执行)

curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo

curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

8.更新yum 缓存(跟前面一样,出现“元数据缓存已建立”代表成功)

yum clean all && yum makecache

9.使用yum list 查看docker版本

yum list docker-ce --showduplicates | sort -r

10.我们安装20.10.6这个版本(这个要等一小会儿)

yum install docker-ce-20.10.6 -y

 11.安装完毕后,配置docker加速器,加速镜像文件的下载

创建目录,配置加速器:

mkdir -p /etc/docker

vim /etc/docker/daemon.json

{
  "registry-mirrors" : [
    "https://8xpk5wnt.mirror.aliyuncs.com"
  ]
}

把这个复制到文件中,全部复制,少一个就配置不成功。要出现这种颜色。

12.重启,设置开机自启

systemctl enable docker  
systemctl daemon-reload
systemctl restart docker

13.查看版本

docker version

到这里docker就安装完成了。

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值