# Check the docker container status

**URL:** <https://forum.ansible.com/t/check-the-docker-container-status/20991>\
**Category:** Ansible Project\
**Created:** [March 26, 2016, 2:30pm UTC](https://forum.ansible.com/t/check-the-docker-container-status/20991 "2016-03-26T14:30:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [March 26, 2016, 2:30pm UTC](https://forum.ansible.com/t/check-the-docker-container-status/20991/1 "2016-03-26T14:30:25Z")

</div>

I have a pretty straightforward script where i copy some configuration files from ansible host to a linux machine and then start a docker container mounting those config files.  
My Docker container are immutable, so i don’t mind recreating them often. In fact, i would like to recreate them in case config changes or they are found stopped. For this i really need a nice way to check status of a container. So the first question - **How can i check the status of a Docker container in Ansible ?** (i would like to avoid the solution where we match for container name and status in the output of Docker ps command)

Currently, my simple idempotent script is:
