title: Ansible docker_container module env file
body: <p>I have an issue with the docker_container module for ansible (v2.3). When i try to pass the <code>env_file</code> properties in the playbook, I get the error :<code>no such file or directory</code></p>
  <pre><code>---
  - hosts: preprod-api
    become: yes
    gather_facts: true
    tasks:
      - name: test configuration
        docker_container:
          name: &quot;backend&quot;
          image: &quot;backend&quot;
          state: started
          exposed_ports:
            - 80
          volumes:
            - /opt/application/i99/current/logs
          user: ansible
          env_file: 
            - &quot;/opt/application/i99/current/backend/backend-PreProd-config.list&quot;
  </code></pre>
  <p>I have tried with a file that exist on the ansible server and one on the target server with the same result.</p>
  <p>here is the error :</p>
  <pre><code>`fatal: [my_hostname]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;module_stderr&quot;: &quot;Shared connection to my_hostname closed.\r\n&quot;, 
  &quot;module_stdout&quot;: &quot;Traceback (most recent call last):
      File \&quot;/tmp/ansible_rySqS2/ansible_module_docker_container.py\&quot;, 
      line 2036, in &lt;module&gt;    main() File \&quot;/tmp/ansible_rySqS2/ansible_module_docker_container.py\&quot;, 
      line 2029, in main\r\n    cm = ContainerManager(client)  File \&quot;/tmp/ansible_rySqS2/ansible_module_docker_container.py\&quot;, 
      line 1668, in __init__\r\n    self.parameters = TaskParameters(client)\r\n  File \&quot;/tmp/ansible_rySqS2/ansible_module_docker_container.py\&quot;, 
      line 784, in __init__\r\n    self.env = self._get_environment()\r\n  File \&quot;/tmp/ansible_rySqS2/ansible_module_docker_container.py\&quot;, 
      line 1134, in _get_environment\r\n    parsed_env_file = utils.parse_env_file(self.env_file)\r\n  File \&quot;/usr/lib/python2.7/site-packages/docker/utils/utils.py\&quot;, 
      line 961, in parse_env_file with open(env_file, 'r') as f:\r\nIOError: [Errno 2] No such file or directory: \&quot;['/path/to/my/file/that/exist/backend-PreProd-config.env']\&quot;\r\n&quot;, &quot;msg&quot;: &quot;MODULE FAILURE&quot;, &quot;rc&quot;: 0}`
  </code></pre>
  <p>So my question is, how can I pass the env file ?</p>