# docker\_container network issue

**URL:** <https://forum.ansible.com/t/docker-container-network-issue/25096>\
**Category:** Ansible Project\
**Created:** [July 26, 2017, 3:53pm UTC](https://forum.ansible.com/t/docker-container-network-issue/25096 "2017-07-26T15:53:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sn.lazamanthony](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@sn.lazamanthony](https://forum.ansible.com/u/sn.lazamanthony)\
**Post date:** [July 26, 2017, 3:53pm UTC](https://forum.ansible.com/t/docker-container-network-issue/25096/1 "2017-07-26T15:53:04Z")

</div>

Hi, I’ve been using the docker\_container module. So far it’s working when creating the image and other options, but when the “networks” option is used then the issue arise.

Here’s the details:

ansible version: ansible 2.2.1.0 (master d5f68d2824) last updated 2017/07/26 15:11:46 (GMT +800)

docker-py version: docker-py (1.9.0)

docker version: 1.9.0  
docker API version: 1.21

Error encountered:

fatal: [10.0.1.110]: FAILED! =\> {“changed”: false, “failed”: true, “module\_stderr”: “Warning: Permanently added ‘host here’ (ECDSA) to the list of known hosts.\r\nWarning: Permanently added ‘10.0.1.110’ (ECDSA) to the list of known hosts.\r\nTraceback (most recent call last):\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 2007, in \n main()\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 2000, in main\n cm = ContainerManager(client)\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 1652, in **init** \n self.present(state)\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 1696, in present\n container = self.update\_networks(container)\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 1761, in update\_networks\n has\_network\_differences, network\_differences = container.has\_network\_differences()\n File "/tmp/ansible\_cdG2O6/ansible\_module\_docker\_container.py", line 1374, in has\_network\_differences\n if connected\_networks.get(network[‘name’], None) is None:\nAttributeError: ‘NoneType’ object has no attribute ‘get’\nKilled by signal 1.\r\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE”}

Playbook:

`

- name: Pull and spawn docker image {{ container\_name }} {{ container\_tag }}  
docker\_container:  
name: “{{ container\_name }}”  
image: “{{ docker\_image }}”  
state: present  
ports: “{{ container\_ports|default(omit) }}”  
pull: true  
networks:
- name: bridge  
ipv4\_address: “{{ docker\_image }}”  
`

There error doesn’t appear when I don’t include any network option in docker\_container module. Any help why this is happening?

Thanks!
