# Info about docker containers

**URL:** <https://forum.ansible.com/t/info-about-docker-containers/22664>\
**Category:** Ansible Project\
**Created:** [September 28, 2016, 1:13pm UTC](https://forum.ansible.com/t/info-about-docker-containers/22664 "2016-09-28T13:13:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ionut\_Cadariu](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@Ionut\_Cadariu](https://forum.ansible.com/u/Ionut_Cadariu)\
**Post date:** [September 28, 2016, 1:13pm UTC](https://forum.ansible.com/t/info-about-docker-containers/22664/1 "2016-09-28T13:13:47Z")

</div>

Hello,

I have docker containers running on multiple hosts and I need to find a way of synchronizing a list of logs from each of these containers to the ansible server but I can’t find a way to do it.

Can someone point me to documentation, give me a hint how I should approach this or to an ansible module (I have found some modules to create containers but not to run commands on them or to extract container ids) ?

Until now I’ve tried using ansible ad-hoc commands but I’m not being able to create a correct playbook to do this for me.  
What I was thinking is to store container ID (obtained using some bash commands) into a variable and with that variable to run docker cp $containerID:/var/log/test .

Thanks,  
Ionut

---

<div class="post-metadata">

**Author:** ![Alexander\_H\_Laughlin](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alexander\_H\_Laughlin](https://forum.ansible.com/u/Alexander_H_Laughlin)\
**Post date:** [September 28, 2016, 11:06pm UTC](https://forum.ansible.com/t/info-about-docker-containers/22664/2 "2016-09-28T23:06:35Z")

</div>

It’s not necessarily practical in your situation, but have you considered mounting the drives via nfs?

---

<div class="post-metadata">

**Author:** ![Yannig\_Perre](https://avatars.discourse-cdn.com/v4/letter/y/5fc32e/32.png) [@Yannig\_Perre](https://forum.ansible.com/u/Yannig_Perre)\
**Post date:** [September 29, 2016, 5:30am UTC](https://forum.ansible.com/t/info-about-docker-containers/22664/3 "2016-09-29T05:30:19Z")

</div>

Hi,

I think you’re looking after this documentation: [http://docs.ansible.com/ansible/intro\_inventory.html#non-ssh-connection-types](http://docs.ansible.com/ansible/intro_inventory.html#non-ssh-connection-types)

You can use ansible\_docker\_extra\_args and provide the docker host associated with your containers (with something like -H=docker-engine1:port).

Then, you can use fetch to retrieve your logs localy in a playbook.

Hope it helps 🙂

Yannig
