当前位置:网站首页>s16. One click installation of containerd script based on image warehouse
s16. One click installation of containerd script based on image warehouse
2022-04-23 15:39:00 【Raymond999999】
[root@rocky8 ~]# cat install_containerd.sh
#!/bin/bash
#
#**********************************************************************************************
#Author: Raymond
#QQ: 88563128
#Date: 2022-04-22
#FileName: install_containerd.sh
#URL: raymond.blog.csdn.net
#Description: install_docker for centos 7/8 & ubuntu 18.04/20.04 Rocky 8
#Copyright (C): 2021 All rights reserved
#*********************************************************************************************
COLOR="echo -e \\033[01;31m"
END='\033[0m'
DOCKER_VERSION=20.10.14
URL='mirrors.cloud.tencent.com'
os(){
OS_ID=`sed -rn '/^NAME=/s@.*="([[:alpha:]]+).*"$@\1@p' /etc/os-release`
}
ubuntu_install_docker(){
dpkg -s docker-ce &>/dev/null && ${COLOR}"Docker already installed , sign out "${END} && exit
${COLOR}" Start installation DOCKER Dependency package "${END}
apt update &> /dev/null
apt -y install apt-transport-https ca-certificates curl software-properties-common &> /dev/null
curl -fsSL https://${URL}/docker-ce/linux/ubuntu/gpg | sudo apt-key add - &> /dev/null
add-apt-repository "deb [arch=amd64] https://${URL}/docker-ce/linux/ubuntu $(lsb_release -cs) stable" &> /dev/null
apt update &> /dev/null
${COLOR}"Docker There are the following versions "${END}
apt-cache madison docker-ce
${COLOR}"10 Will be installed in seconds :Docker-"${DOCKER_VERSION}" edition ......"${END}
${COLOR}" If you want to install other Docker edition , Please press Ctrl+c Key to exit , Modify the version and then execute "${END}
sleep 10
${COLOR}" Start installation DOCKER"${END}
apt -y install docker-ce=5:${DOCKER_VERSION}~3-0~ubuntu-$(lsb_release -cs) docker-ce-cli=5:${DOCKER_VERSION}~3-0~ubuntu-$(lsb_release -cs) &> /dev/null || {
${COLOR}"apt Source failure , Please check apt To configure "${END};exit; }
}
centos_install_docker(){
rpm -q docker-ce &> /dev/null && ${COLOR}"Docker already installed , sign out "${END} && exit
${COLOR}" Start installation DOCKER Dependency package "${END}
yum -y install yum-utils &> /dev/null
yum-config-manager --add-repo https://${URL}/docker-ce/linux/centos/docker-ce.repo &> /dev/null
sed -i 's+download.docker.com+'''${URL}'''/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum clean all &> /dev/null
yum makecache &> /dev/null
${COLOR}"Docker There are the following versions "${END}
yum list docker-ce.x86_64 --showduplicates
${COLOR}"10 Will be installed in seconds :Docker-"${DOCKER_VERSION}" edition ......"${END}
${COLOR}" If you want to install other Docker edition , Please press Ctrl+c Key to exit , Modify the version and then execute "${END}
sleep 10
${COLOR}" Start installation DOCKER"${END}
yum -y install docker-ce-${DOCKER_VERSION} docker-ce-cli-${DOCKER_VERSION} &> /dev/null || {
${COLOR}"yum Source failure , Please check yum To configure "${END};exit; }
}
config_containerd(){
cat > /etc/modules-load.d/containerd.conf <<-EOF overlay br_netfilter EOF
modprobe -- overlay
modprobe -- br_netfilter
cat > /etc/sysctl.d/99-kubernetes-cri.conf <<-EOF net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-ip6tables = 1 EOF
sysctl --system &> /dev/null
mkdir -p /etc/containerd
containerd config default | tee /etc/containerd/config.toml &> /dev/null
sed -ri 's/(.*SystemdCgroup = ).*/\1true/' /etc/containerd/config.toml
sed -ri 's@(.*sandbox_image = ).*@\1\"registry.aliyuncs.com/google_containers/pause:3.6\"@' /etc/containerd/config.toml
sed -i '/.*registry.mirrors.*/a\ [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]\n endpoint = ["https://registry.docker-cn.com" ,"http://hub-mirror.c.163.com" ,"https://docker.mirrors.ustc.edu.cn"]' /etc/containerd/config.toml
systemctl daemon-reload && systemctl enable --now containerd &> /dev/null
cat > /etc/crictl.yaml <<-EOF runtime-endpoint: unix:///run/containerd/containerd.sock image-endpoint: unix:///run/containerd/containerd.sock timeout: 10 debug: false EOF
systemctl is-active containerd &> /dev/null && ${COLOR}"Containerd Service started successfully "${END} || {
${COLOR}"Containerd Boot failure "${END};exit; }
ctr version && ${COLOR}"Containerd Installation successful "${END} || ${COLOR}"Containerd Installation failed "${END}
}
main(){
os
if [ ${OS_ID} == "CentOS" -o ${OS_ID} == "Rocky" ] &> /dev/null;then
centos_install_docker
else
ubuntu_install_docker
fi
config_containerd
}
main
版权声明
本文为[Raymond999999]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231535487422.html
边栏推荐
- 电脑怎么重装系统后显示器没有信号了
- Cookie&Session
- How did the computer reinstall the system? The display has no signal
- What if the server is poisoned? How does the server prevent virus intrusion?
- 时序模型:门控循环单元网络(GRU)
- What exactly does the distributed core principle analysis that fascinates Alibaba P8? I was surprised after reading it
- Crawling fragment of a button style on a website
- 一刷313-剑指 Offer 06. 从尾到头打印链表(e)
- CVPR 2022 优质论文分享
- 【AI周报】英伟达用AI设计芯片;不完美的Transformer要克服自注意力的理论缺陷
猜你喜欢
CAP定理
Detailed explanation of redirection and request forwarding
For examination
IronPDF for .NET 2022.4.5455
MySQL Cluster Mode and application scenario
JVM-第2章-类加载子系统(Class Loader Subsystem)
服务器中毒了怎么办?服务器怎么防止病毒入侵?
Machine learning - logistic regression
Recommended search common evaluation indicators
Mobile finance (for personal use)
随机推荐
群体智能自主作业智慧农场项目启动及实施方案论证会议
提取不重复的整数
Code live collection ▏ software test report template Fan Wen is here
什么是CNAS认证?CNAS认可的软件测评中心有哪些?
字节面试 transformer相关问题 整理复盘
php函数
Connectez PHP à MySQL via aodbc
Educational codeforces round 127 A-E problem solution
Go语言数组,指针,结构体
MySQL Cluster Mode and application scenario
WPS品牌再升级专注国内,另两款国产软件低调出国门,却遭禁令
【backtrader源码解析18】yahoo.py 代码注释及解析(枯燥,对代码感兴趣,可以参考)
Explanation of redis database (I)
Node.js ODBC连接PostgreSQL
Redis主从复制过程
Basic concepts of website construction and management
KNN, kmeans and GMM
Connect PHP to MySQL via PDO ODBC
pywintypes.com_error: (-2147221020, ‘无效的语法‘, None, None)
Leetcode学习计划之动态规划入门day3(198,213,740)