Skip to content

Commit

Permalink
Disable default docker bridge network
Browse files Browse the repository at this point in the history
It prevents docker NAT network form being created on
Windows hosts.

Change-Id: I664402c7c93270639b31a7611b9004b2ef0512e4
Closes-Bug: #1787928
  • Loading branch information
magdalena-zaremba committed Aug 22, 2018
1 parent f2682b5 commit 55c1669
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playbooks/roles/configure_instances/defaults/main.yml
@@ -0,0 +1,2 @@
win_docker_config_dir: C:\ProgramData\docker\config
win_docker_daemon_file: "{{ win_docker_config_dir }}\\daemon.json"
Expand Up @@ -55,6 +55,33 @@
win_psmodule:
name: DockerMsftProvider

- name: ensure docker config directory exists
win_file:
path: "{{ win_docker_config_dir }}"
state: directory

- name: ensure docker config file exists
win_file:
path: "{{ win_docker_daemon_file }}"
state: touch

- name: read docker config file
register: docker_daemon_file
win_shell: Get-Content "{{ win_docker_daemon_file }}"

- name: convert docker config entries to json
set_fact:
docker_daemon: "{{ docker_daemon_file.stdout | default('{}', true) | from_json }}"

- name: disable the nat network in docker config
set_fact:
docker_daemon: "{{ docker_daemon | combine({\"bridge\" : \"none\"}) }}"

- name: write config to daemon.json
win_copy:
content: "{{ docker_daemon | to_nice_json }}"
dest: "{{ win_docker_daemon_file }}"

- name: install Docker-EE
win_shell: "Install-Package Docker -ProviderName DockerMsftProvider -Force"

Expand Down

0 comments on commit 55c1669

Please sign in to comment.