# How to restart docker containers with ansible?

**URL:** <https://forum.ansible.com/t/how-to-restart-docker-containers-with-ansible/20043>\
**Category:** Ansible Project\
**Created:** [December 17, 2015, 8:15pm UTC](https://forum.ansible.com/t/how-to-restart-docker-containers-with-ansible/20043 "2015-12-17T20:15:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dump\_Hole](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@Dump\_Hole](https://forum.ansible.com/u/Dump_Hole)\
**Post date:** [December 17, 2015, 8:15pm UTC](https://forum.ansible.com/t/how-to-restart-docker-containers-with-ansible/20043/1 "2015-12-17T20:15:42Z")

</div>

It seems the docker module for ansible is geared toward spinning up new containers, but not restarting an existing running container.

In command line, all you need is the container name. It is as simple as  
sudo docker stop \<container\_name\>  
sudo docker start \<container\_name\>

But Ansible’s docker requires ‘image’, which complicates things as now it has to remember all the settings how the container was first created.
