From 82fc36426a6511e47048dc7955581e3905d276c9 Mon Sep 17 00:00:00 2001 From: opcache <7529997@qq.com> Date: Sat, 30 May 2020 23:41:01 +0000 Subject: [PATCH] docker-18.09.8 --- docker/README.md | 18 ++++++++++++ docker/install-docker-18.09.8.sh | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 docker/README.md create mode 100644 docker/install-docker-18.09.8.sh diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..c7faece --- /dev/null +++ b/docker/README.md @@ -0,0 +1,18 @@ +# 快速Docker安装 + +## 自动yum安装Docker,Docker配置yum源 +## yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo +## curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo +## curl -o /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo +## daemon.json k8s私有可以增加 "insecure-registries":["harbor.io", "k8s.gcr.io", "gcr.io", "quay.io"], +## 卸载docker命令 yum remove -y docker-ce docker-common-* + + +# 使用方法 +``` +bash install-docker-18.09.8.sh +``` + +``` +curl -s https://gitee.com/aqztcom/kjyw/raw/master/docker/install-docker-18.09.8.sh | bash +``` \ No newline at end of file diff --git a/docker/install-docker-18.09.8.sh b/docker/install-docker-18.09.8.sh new file mode 100644 index 0000000..fe404b1 --- /dev/null +++ b/docker/install-docker-18.09.8.sh @@ -0,0 +1,47 @@ +#!/bin/bash +## 自动yum安装Docker,Docker配置yum源 2020-05-31 +## 有问题反馈 https://aq2.cn/c/docker +## email: ppabc@qq.com +## robert yu +## redhat 7 + +##安装 +## yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo +## curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo +## curl -o /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo +## daemon.json k8s私有可以增加 "insecure-registries":["harbor.io", "k8s.gcr.io", "gcr.io", "quay.io"], +## 卸载docker命令 yum remove -y docker-ce docker-common-* + + +yum-config-manager --add-repo https://mirrors.aliyun.com/repo/Centos-7.repo +yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo +yum makecache fast +yum install -y yum-utils device-mapper-persistent-data lvm2 nfs-utils conntrack-tools +yum install -y docker-ce-18.09.8 docker-ce-cli-18.09.8 + + +##配置docker源 +mkdir -p /etc/docker +if [[ -f /etc/docker/daemon.json ]] ; then + /usr/bin/cp /etc/docker/daemon.json /etc/docker/daemon.json.bak.`date "+%Y%m%d%H%M%S"` +fi +echo -e ' +{ + "storage-driver": "overlay2", + "storage-opts": [ "overlay2.override_kernel_check=true" ], + "registry-mirrors": ["https://4ux5p520.mirror.aliyuncs.com"], + "exec-opts": ["native.cgroupdriver=systemd"], + "data-root": "/data/docker", + "log-driver": "json-file", + "log-opts": { + "max-size": "100m" + } +} +' > /etc/docker/daemon.json + + +##启动 +systemctl daemon-reload +systemctl enable docker +systemctl restart docker +docker version \ No newline at end of file