# docker\_container and etc\_hosts

**URL:** <https://forum.ansible.com/t/docker-container-and-etc-hosts/26370>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [December 23, 2017, 2:34am UTC](https://forum.ansible.com/t/docker-container-and-etc-hosts/26370 "2017-12-23T02:34:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Butch](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Matt\_Butch](https://forum.ansible.com/u/Matt_Butch)\
**Post date:** [December 23, 2017, 2:34am UTC](https://forum.ansible.com/t/docker-container-and-etc-hosts/26370/1 "2017-12-23T02:34:47Z")

</div>

I have another playbook that sets up a docker container, and now I want to add to the hosts file. Why does this not work?

- name: Add host entry  
docker\_container:  
name: “{{ item }}”  
etc\_hosts: “{‘[server.place.com](http://server.place.com)’: ‘{{ server\_ip }}’}”  
with\_items:
- “container1”
- “container2”

TASK [awx : Add host entry] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

failed: [123.123.123.123] (item= container1) =\> {“changed”: false, “item”: “container1”, “msg”: “Error creating container: 400 Client Error: Bad Request ("No command specified")”}

failed: [123.123.123.123] (item= container2) =\> {“changed”: false, “item”: “container2”, “msg”: “Error creating container: 400 Client Error: Bad Request ("No command specified")”}

If this is a bug, I’m happy to submit a report. I just wanted to make sure I wasn’t doing something wrong.
