Connecting to container using ansible
<p>I have build a docker image and started the container using ansible.  I'm running into an issue trying to create a dynamic connection to the container from the docker host to set some environment variable and execute some script.  I know ansible does not use ssh to connect to the container where I can can use the expect module to run this command "ssh root@localhost -p 12345".  How do I add and maintain a connection to the container using <strong>ansible</strong> docker connection plugin or pointing directly to the docker host? This is all running in AWS EC2 instance.    </p>

<p>I think I need to run ansible as an equivalent to this command use by ansible to connect to the container host "docker exec -i -t container_host_server /bin/bash".</p>

<hr>

<ul>
<li>name: Create a data container<br>
docker_container:<br>
 name: packageserver<br>
 image: my_image/image_name<br>
 tty: yes<br>
 state: started<br>
 detach: True<br>
 detach: yes<br>
 volumes:  

<ul>
<li>/var/www/html<br>
published_ports:  </li>
<li>"12345:22"  </li>
<li>"80:80"<br>
register: container  </li>
</ul></li>
</ul>

<p>Thanks in Advance,
DT</p>