Dokcer-ce安装脚本
程序员文章站
2022-07-01 22:39:59
1 #!/bin/bash 2 # coding: utf-8 3 # Copyright (c) 2018 4 set -e #返回值为0时,退出脚本 5 echo "1. 备份yum" 6 { 7 for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.re ......
安装docker
1 #!/bin/bash 2 # coding: utf-8 3 # copyright (c) 2018 4 set -e #返回值为0时,退出脚本 5 echo "1. 备份yum" 6 { 7 for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}.bak;done 8 rm -rf /etc/yum.repos.d/*.repo 9 } || { 10 echo "备份出错,请手动执行" 11 exit 1 12 } 13 14 echo "2. 获取网络yum" 15 { 16 wget -p /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/centos-7.repo >/dev/null 2>&1 17 wget -p /etc/yum.repos.d/ http://mirrors.163.com/.help/centos7-base-163.repo >/dev/null 2>&1 18 yum clean >/dev/null 2>&1 19 yum repolist >/dev/null 2>&1 20 } || { 21 echo "获取出错,请手动执行" 22 exit 1 23 } 24 25 echo "3. 安装docker-ce......" 26 { 27 yum -y install yum-utils >/dev/null 2>&1 28 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo >/dev/null 2>&1 29 yum clean >/dev/null 2>&1 30 yum repolist >/dev/null 2>&1 31 yum -y install epel-release docker-ce >/dev/null 2>&1 32 } || { 33 echo "安装出错,请手动安装" 34 exit 1 35 } 36 37 systemctl start docker >/dev/null 2>&1 38 systemctl enable docker >/dev/null 2>&1 39 40 echo "4. 添加内和参数" 41 { 42 cat <<eof>> /etc/sysctl.conf 43 net.bridge.bridge-nf-call-ip6tables = 1 44 net.bridge.bridge-nf-call-iptables = 1 45 eof 46 sysctl -p >/dev/null 2>&1 47 } 48 49 echo "5. 添加镜像加速" 50 { 51 cat <<eof>> /etc/docker/daemon.json 52 { 53 "registry-mirrors": [ 54 "https://registry.docker-cn.com" 55 ] 56 } 57 eof 58 } 59 60 systemctl daemon-reload >/dev/null 2>&1 61 systemctl restart docker >/dev/null 2>&1 62 63 rm -rf ./*.sh
下一篇: JSP视频在线播放
推荐阅读
-
Java Runtime Environment怎么安装 JRE安装详细图文教程
-
keil c51破解版如何使用 keil c51破解版安装使用图文教程(附下载地址)
-
DS CADAM Drafting V5-6R2018 SP1安装破解激活图文详细教程(附下载)
-
至善读书uread图文安装使用教程
-
Sublime Text 3 常用插件以及安装方法(图文)
-
Visual Studio2015怎么安装Visual Assist X插件?
-
开贝影擎怎么安装?开贝影擎软件及分机安装图文教程
-
Android Studio怎么手动安装Genymotion插件?
-
eclipse怎么导入Api文档?eclipse安装Api文件的方法
-
PTC Creo 3.0 M160中文破解版安装激活图文详细教程(附下载)