diff --git a/docker/defaults/main.yml b/docker/defaults/main.yml index fb9aa1b2..3eed9ecb 100644 --- a/docker/defaults/main.yml +++ b/docker/defaults/main.yml @@ -13,3 +13,7 @@ docker_packages: docker_run_as_docker_user: True docker_user_home: /home/docker +docker_defaults_file: /etc/default/docker +docker_enable_tcp_socket: False +docker_tcp_socket_port: 2375 +docker_tcp_socket_host: 127.0.0.1 diff --git a/docker/tasks/pkgs.yml b/docker/tasks/pkgs.yml index a37461c1..e56d3d54 100644 --- a/docker/tasks/pkgs.yml +++ b/docker/tasks/pkgs.yml @@ -14,6 +14,10 @@ apt: pkg={{ item }} state={{ docker_pkg_status }} update_cache=yes cache_valid_time=3600 with_items: '{{ docker_packages }}' + - name: Install the Docker default options + template: src=docker-default.j2 dest={{ docker_defaults_file }} owner=root group=root mode=0644 + notify: Restart docker + - name: Ensure that the service is started and enabled service: name=docker state=started enabled=yes diff --git a/docker/templates/docker-default.j2 b/docker/templates/docker-default.j2 new file mode 100644 index 00000000..dec0522c --- /dev/null +++ b/docker/templates/docker-default.j2 @@ -0,0 +1,15 @@ +# Customize location of Docker binary (especially for development testing). +#DOCKERD="/usr/local/bin/dockerd" + + +CUSTOM_DOCKER_SOCKET="-H tcp://{{ docker_tcp_socket_host }}:{{ docker_tcp_socket_port }} -H unix:///var/run/docker.sock" +#CUSTOM_DOCKER_DNS_SERVERS="--dns 8.8.8.8 --dns 8.8.4.4" + +# Use DOCKER_OPTS to modify the daemon startup options. +DOCKER_OPTS="{% if docker_enable_tcp_socket %}$CUSTOM_DOCKER_SOCKET {% endif %}" + +# 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 DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"