shell :二進制安裝docker

#!/bin/bash
#設置字體顏色
function RedFont(){echo -e "\033[31mError: $1 \033[0m"
}function GreenFont(){echo -e "\033[32mInfo: $1 \033[0m"
}function YellowFont(){echo -e "\033[33mWarning: $1 \033[0m"
}CURRENT_DIR=`pwd`
FILE_NAME='docker-20.10.9.tgz'GreenFont "CURRENT_DIR: ${CURRENT_DIR}"
GreenFont "FILE_NAME: ${FILE_NAME}"if [ ! -f "${CURRENT_DIR}/${FILE_NAME}" ];thenYellowFont "${CURRENT_DIR}/${FILE_NAME} not found, exit"exit 1
fiGreenFont "創建數據目錄和配置文件目錄"
mkdir -p /data/docker
ln -s /data/docker /var/lib/
mkdir -p /etc/docker
groupadd dockerGreenFont "解壓安裝${CURRENT_DIR}/${FILE_NAME}"
cd ${CURRENT_DIR}
tar -zxvf ${CURRENT_DIR}/${FILE_NAME}
chown -R root.root ${CURRENT_DIR}/docker
cp ${CURRENT_DIR}/docker/* /usr/bin/
docker -v || { RedFont "docker安裝失敗";exit 1;}GreenFont "生成docker服務文件:/etc/systemd/system/docker.service"
## 生成docker服務文件:/etc/systemd/system/docker.service
cat > /etc/systemd/system/docker.service << EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP \$MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500[Install]
WantedBy=multi-user.target
EOFGreenFont "生成containerd服務文件:/etc/systemd/system/containerd.service"
## 生成containerd服務文件:/etc/systemd/system/containerd.servicecat > /etc/systemd/system/containerd.service << EOF
# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerdType=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999[Install]
WantedBy=multi-user.targetEOFGreenFont "生成socket服務文件:/etc/systemd/system/docker.socket"
## 生成socket服務文件:/etc/systemd/system/docker.socketcat > /etc/systemd/system/docker.socket << EOF[Unit]
Description=Docker Socket for the API[Socket]
# If /var/run is not implemented as a symlink to /run, you may need to
# specify ListenStream=/var/run/docker.sock instead.
ListenStream=/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker[Install]
WantedBy=sockets.target
EOFGreenFont "生成docker配置文件:/etc/docker/daemon.json"
## 生成docker配置文件:/etc/docker/daemon.jsoncat > /etc/docker/daemon.json << EOF
{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","http://hub-mirror.c.163.com"],"insecure-registries": ["test.hub"],"max-concurrent-downloads": 10,"log-driver": "json-file","log-level": "warn","log-opts": {"max-size": "10m","max-file": "3"},"data-root": "/var/lib/docker"
}
EOFGreenFont "重新加載服務文件"
systemctl daemon-reloadGreenFont "啟動docker.socket"
systemctl enable docker.socket
systemctl start docker.socket
systemctl status docker.socketGreenFont "啟動containerd.service"
systemctl enable containerd.service
systemctl start containerd.service
systemctl status containerd.serviceGreenFont "啟動docker.service"
systemctl enable docker.service
systemctl start docker.service
systemctl status docker.serviceGreenFont "執行完畢"

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/14476.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/14476.shtml
英文地址,請注明出處:http://en.pswp.cn/web/14476.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

漢明碼(海明碼)的計算的規則

一.漢明碼的由來 1.漢明碼&#xff08;Hamming Code&#xff09;&#xff0c;是在電信領域的一種線性調試碼&#xff0c;以發明者理查德衛斯里漢明的名字命名。漢明碼在傳輸的消息流中插入驗證碼&#xff0c;當計算機存儲或移動數據時&#xff0c;可能會產生數據位錯誤&#x…

【VUE】 如何關閉ESlint的自動修復功能

問題描述例如&#xff1a;原書寫代碼ESLint自動修復報錯如下 方案一、在文件中添加屏蔽警告的代碼html代碼中JavaScript代碼中 方案二、關閉ESLint的自動修復功能1、VSCode 擴展找到 ESLint 插件2、在設置中找到在 settings,json 中編輯3、將"autoFix": true改為&quo…

3.2 運維、運營和經營

第3章 信息技術服務知識 3.2 運維、運營和經營 3.2.1 運維 1、運維是運行維護的簡稱&#xff0c;是一種IT服務形態。2、在《信息技術服務分類與代碼》&#xff08;GB/T29264-20l2&#xff09;中&#xff0c;對運行維護服務&#xff08;operation maintenance service&#x…

4.雙指針+遞歸

一、雙指針編程技巧 方法參數傳遞數組 將數組通過方法參數傳遞&#xff0c;方法操作的數組和main方法中的數組指向同一塊內存區域&#xff0c;意味著方法操作數組&#xff0c;同時會引起main方法中數組的改變以引用的方式作為方法參數進行傳遞的 元素交換 定義臨時變量temp&a…

第十二節 SpringBoot Starter 系列結束語

感謝閱讀&#xff0c;到這里&#xff0c;本系列課程就結束了。 一、為什么選擇 SpringBoot Starter SpringBoot 近年來已經成為 Java 應用的必備框架&#xff1b; 而 SpringBoot starter 模式已經成為各大中間件集成到 SpringBoot 應用的首選方式&#xff0c;通過引入 xxx-st…

C++ | Leetcode C++題解之第101題對稱二叉樹

題目&#xff1a; 題解&#xff1a; class Solution { public:bool check(TreeNode *u, TreeNode *v) {queue <TreeNode*> q;q.push(u); q.push(v);while (!q.empty()) {u q.front(); q.pop();v q.front(); q.pop();if (!u && !v) continue;if ((!u || !v) ||…

爬蟲基礎1

一、爬蟲的基本概念 1.什么是爬蟲&#xff1f; 請求網站并提取數據的自動化程序 2.爬蟲的分類 2.1 通用爬蟲&#xff08;大而全&#xff09; 功能強大&#xff0c;采集面廣&#xff0c;通常用于搜索引擎&#xff1a;百度&#xff0c;360&#xff0c;谷歌 2.2 聚焦爬蟲&#x…

Android App啟動流程和源碼詳解

前言 之前看了些App啟動流程的文章&#xff0c;但是看得很淺顯&#xff0c;隔了沒多久就忘了&#xff0c;自己抓耳撓腮的終于看完了&#xff0c;看得頭疼哦。因為很多是個人理解&#xff0c;大哥們主打一個7分信&#xff0c;2分思考&#xff0c;1分懷疑哈。 主要看的源碼是An…

pytorch-20_1 LSTM在股價數據集上的預測實戰

LSTM在股價數據集上的預測實戰 使用完整的JPX賽題數據&#xff0c;并向大家提供完整的lstm流程。 導包 import numpy as np #數據處理 import pandas as pd #數據處理 import matplotlib as mlp import matplotlib.pyplot as plt #繪圖 from sklearn.preprocessing import M…

人類交互4 感覺輸入和運動輸出

人類感覺系統概述 人類感覺系統是由多個感覺器官和神經系統組成&#xff0c;負責感知外部世界的各種刺激和信息。人類感覺系統包括以下幾個主要部分&#xff1a; 視覺系統&#xff1a;視覺系統由眼睛、視神經和大腦視覺皮層組成&#xff0c;負責感知光線、顏色和形狀&#xff…

datasheet芯片數據手冊—新手入門學習(二)【8-18】

參考芯片手冊已經上傳&#xff0c;可自行下載 因為芯片參考手冊內容比較多&#xff0c;故再一次介紹本文內容主要講解章節。 目錄 8、內容介紹 命令真值表 9、Command Definitions 10、READ Operations &#xff08;1&#xff09;頁面讀取操作 &#xff08;2&#xff…

YTM32的flash應用答疑-詳解寫保護功能

YTM32的flash應用答疑-詳解寫保護功能 文章目錄 YTM32的flash應用答疑-詳解寫保護功能IntroductionPrincipleOperation & DemonstrationDemo #1 驗證基本的寫保護功能Demo #2 編程CUS_NVR設定EFM_ADDR_PROT初值Demo #3 啟用寫保護后試試塊擦除操作 Conclusion Introduction…

報名倒計時兩周|2024 OpenTiny 開源之夏項目直播解讀回顧

5月16日&#xff0c;OpenTiny 開源社區成功舉辦了以《OpenTiny 開源之夏項目解讀直播》為主題的直播活動。此次直播中&#xff0c;華為云的高級前端工程師曾令卡、華為云的高級前端工程師伍其和與10位開源之夏技術專家攜手組成項目導師團&#xff0c;面向廣大開發者一同深入探討…

Java類和對象(五)—— 抽象類、接口、Object類和內部類

抽象類 在繼承體系下&#xff0c;父類有些方法可能是要被重寫的&#xff0c;如果我們事先就知道某些方法需要重寫的話&#xff0c;我們可以不用在父類里面具體實現這個方法&#xff0c;這時候我們會用到抽象方法&#xff0c;這時候我們會用到關鍵字abstract關鍵字來修飾 publ…

BatBot智慧能源管理平臺,更加有效地管理能源

隨著能源消耗的不斷增加&#xff0c;能源管理已成為全球面臨的重要問題。BatBot智慧能源管理作為一種的能源管理技術&#xff0c;促進企業在用能效率及管理有著巨大的提升。 BatBot智慧能源管理是一種基于人工智能技術的能源管理系統&#xff0c;通過智能分析和優化能源使用&…

【JAVA |再談接口、Object、內部類】Object類中子類重寫,Cloneable 接口、比較器、內部類

??謝謝大家捧場&#xff0c;祝屏幕前的小伙伴們每天都有好運相伴左右&#xff0c;一定要天天開心哦&#xff01;?? &#x1f388;&#x1f388;作者主頁&#xff1a; &#x1f388;丠丠64-CSDN博客&#x1f388; ?? 帥哥美女們&#xff0c;我們共同加油&#xff01;一起…

Internet動態路由選擇—RIP與OSPF

剛做完網絡層動態路由選擇的實驗&#xff0c;寫下此篇記錄實驗過程&#xff0c;鞏固學習成果。 參考書目&#xff1a;《計算機網絡》北京理工大學出版社-劉陽老師編 路由選擇可分為兩種策略&#xff1a; - 靜態路由選擇策略 - 動態路由選擇策略 靜態路由即管理員手動配置路由…

Java 商品入庫系統 案例

測試類 package 練習.商品入庫系統;import java.util.ArrayList; import java.util.Scanner; public class Test {public static final int Enrool 1;public static final int Search 2;public static final int Delect 3;public static final int Exit 4;public static…

在docker上部署postgresSQL主從

文章目錄 一、主從規劃二、創建PostgresSQL的Docker鏡像三、主庫部署1、建立pgsql主庫的data地址2、啟動docker鏡像3、docker內操作4、修改配置文件 四、部署從數據庫1、建立psql備庫的data地址2、啟動docker鏡像3、備庫從主庫同步4、檢查是否同步 五、測試主從數據庫 一、主從…

#2495. 滑動窗口 /【模板】單調隊列

題目描述 有一個長為 ( n ) 的序列 ( a )&#xff0c;以及一個大小為 ( k ) 的窗口。現在這個窗口從左邊開始向右滑動&#xff0c;每次滑動一個單位&#xff0c;求出每次滑動后窗口中的最大值和最小值。例如&#xff1a; 數組是 ([1, 3, -1, -3, 5, 3, 6, 7])&#xff0c; ( …