From 8278b1e0048ac199e5acae622e73e99e4e11b4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E5=85=B3=E9=83=A8=E9=97=A8?= Date: Fri, 26 Jul 2019 15:07:28 +0800 Subject: [PATCH] =?UTF-8?q?Docker=E5=AE=89=E8=A3=85=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BF=A1=E4=BB=BB=E5=86=85=E9=83=A8=E4=BB=93=E5=BA=93=20(#651)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker安装增加信任内部仓库 --- example/hosts.allinone | 6 ++++++ example/hosts.multi-node | 6 ++++++ roles/docker/defaults/main.yml | 3 +++ roles/docker/templates/daemon.json.j2 | 1 + 4 files changed, 16 insertions(+) diff --git a/example/hosts.allinone b/example/hosts.allinone index fe9d1d6..f233ebb 100644 --- a/example/hosts.allinone +++ b/example/hosts.allinone @@ -45,6 +45,12 @@ NODE_PORT_RANGE="20000-40000" # Cluster DNS Domain CLUSTER_DNS_DOMAIN="cluster.local." +# Docker data ROOT +# STORAGE_DIR="/var/lib/docker" + +# Docker insecure registry +# INSECURE_REG='["127.0.0.1/8"]' + # -------- Additional Variables (don't change the default value right now)--- # Binaries Directory bin_dir="/opt/kube/bin" diff --git a/example/hosts.multi-node b/example/hosts.multi-node index 18472cc..9afb075 100644 --- a/example/hosts.multi-node +++ b/example/hosts.multi-node @@ -49,6 +49,12 @@ NODE_PORT_RANGE="20000-40000" # Cluster DNS Domain CLUSTER_DNS_DOMAIN="cluster.local." +# Docker data ROOT +# STORAGE_DIR="/var/lib/docker" + +# Docker insecure registry +# INSECURE_REG='["127.0.0.1/8"]' + # -------- Additional Variables (don't change the default value right now) --- # Binaries Directory bin_dir="/opt/kube/bin" diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 1593d99..6b3b163 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -16,3 +16,6 @@ ENABLE_MIRROR_REGISTRY: true # 设置 docker 仓库镜像 REG_MIRRORS: '["https://dockerhub.azk8s.cn", "https://docker.mirrors.ustc.edu.cn"]' + +# 信任的HTTP仓库 +INSECURE_REG: '["127.0.0.1/8"]' diff --git a/roles/docker/templates/daemon.json.j2 b/roles/docker/templates/daemon.json.j2 index 7036543..358ebbb 100644 --- a/roles/docker/templates/daemon.json.j2 +++ b/roles/docker/templates/daemon.json.j2 @@ -5,6 +5,7 @@ {% if ENABLE_REMOTE_API %} "hosts": ["tcp://0.0.0.0:2376", "unix:///var/run/docker.sock"], {% endif %} + "insecure-registries": {{ INSECURE_REG }}, "max-concurrent-downloads": 10, "log-driver": "{{ LOG_DRIVER }}", "log-level": "{{ LOG_LEVEL }}",