docker_container and etc_hosts

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’: ‘{{ 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.