Allow setting insecure registries
diff --git a/README.rst b/README.rst
index 4039078..ccc9022 100644
--- a/README.rst
+++ b/README.rst
@@ -23,6 +23,8 @@
docker:
host:
enabled: true
+ insecure_registries:
+ - 127.0.0.1
Client
------
diff --git a/docker/files/config b/docker/files/config
deleted file mode 100644
index 5bceab7..0000000
--- a/docker/files/config
+++ /dev/null
@@ -1,19 +0,0 @@
-{% from "docker/map.jinja" import server with context %}
-
-# Docker Upstart and SysVinit configuration file
-
-# Customize location of Docker binary (especially for development testing).
-#DOCKER="/usr/local/bin/docker"
-
-# Use DOCKER_OPTS to modify the daemon startup options.
-#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
-
-# If you need Docker to use an HTTP proxy, it can also be specified here.
-#export http_proxy="http://127.0.0.1:3128/"
-
-# This is also a handy place to tweak where Docker's temporary files go.
-#export TMPDIR="/mnt/bigdrive/docker-tmp"
-
-{% for line in server.get("config", []) %}
-{{ line }}
-{% endfor %}
diff --git a/docker/files/daemon.json b/docker/files/daemon.json
new file mode 100644
index 0000000..018d259
--- /dev/null
+++ b/docker/files/daemon.json
@@ -0,0 +1,13 @@
+{% from "docker/map.jinja" import host with context %}
+{
+ {%- if host.insecure_registries is defined %}
+ "insecure-registries": [
+ {%- for registry in host.insecure_registries %}
+ "{{ registry }}"{% if not loop.last %},{% endif %}
+ {%- endfor %}
+ ]
+ {%- endif %}
+}
+{#-
+ vim: syntax=jinja
+-#}
diff --git a/docker/host.sls b/docker/host.sls
index 58c2997..81b3b98 100644
--- a/docker/host.sls
+++ b/docker/host.sls
@@ -23,6 +23,15 @@
{%- endif %}
+/etc/docker/daemon.json:
+ file.managed:
+ - source: salt://docker/files/daemon.json
+ - template: jinja
+ - require:
+ - pkg: docker_packages
+ - watch_in:
+ - service: docker_service
+
docker_service:
service.running:
- name: {{ host.service }}