From 37504046c6d73927676992a76f692c990b4d6043 Mon Sep 17 00:00:00 2001 From: lusyoe Date: Fri, 18 Jan 2019 13:36:48 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=90=AFdocker?= =?UTF-8?q?=E8=BF=9C=E7=A8=8BAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/docker/defaults/main.yml | 3 +++ roles/docker/templates/daemon.json.j2 | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 707ccafdd..8c7ef6ae9 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -12,3 +12,6 @@ LOG_MAX_FILE: 3 # docker容器存储目录 STORAGE_DIR: "/var/lib/docker" + +# 开启Restful API +ENABLE_REMOTE_API: true diff --git a/roles/docker/templates/daemon.json.j2 b/roles/docker/templates/daemon.json.j2 index a024bf7ec..ff627fbca 100644 --- a/roles/docker/templates/daemon.json.j2 +++ b/roles/docker/templates/daemon.json.j2 @@ -8,4 +8,9 @@ "max-file": "{{ LOG_MAX_FILE }}" }, "data-root": "{{ STORAGE_DIR }}" + + {% if ENABLE_REMOTE_API %} + , "hosts": ["tcp://0.0.0.0:2376", "unix:///var/run/docker.sock"] + {% endif %} + } From 4602da942dbd0d369cba638d048f7f50c774a40c Mon Sep 17 00:00:00 2001 From: lusyoe Date: Mon, 21 Jan 2019 13:43:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4docker=E8=BF=9C=E7=A8=8BA?= =?UTF-8?q?PI=E9=BB=98=E8=AE=A4=E4=B8=BA=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/docker/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 8c7ef6ae9..82b3d5439 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -14,4 +14,4 @@ LOG_MAX_FILE: 3 STORAGE_DIR: "/var/lib/docker" # 开启Restful API -ENABLE_REMOTE_API: true +ENABLE_REMOTE_API: false