2、Docker自动化安装

一、环境设置

1.1、系统设置

OS :Centos 8

ip和域名设定

192.168.25.75  k8s-master.zhouyihua.com

192.168.25.76 k8s-node1.zhouyihua.com

192.168.25.77 k8s-node2.zhouyihua.com

1.2、卸载podman,系统默认安装了podman容器和docker有冲突

#!/bin/bash

#zhouyihua

#v0.1

#2021-09-05

yum remove podman -y

yum erase podman buildah -y

setenforce 0

sed -i  's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

#DISABLE SWAP

swapoff -a

sed -i 's/.*swap.*/#&/' /etc/fstab

systemctl stop firewalld.service

systemctl disable firewalld.service

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

yum install -y yum-utils device-mapper-persistent-data lvm2 net-tools

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

yum install containerd.io-1.2.6-3.3.el7.x86_64.rpm -y

mkdir -p /etc/docker

vim /etc/docker/daemon.json << EOF

{

  "registry-mirrors" : ["https://mj9kvemk.mirror.aliyuncs.com"]

}

EOF

yum -y install docker-ce

systemctl daemon-reload && systemctl start docker

systemctl enable docker

你可能感兴趣的:(2、Docker自动化安装)