# "Cannot start container" when running docker task

**URL:** <https://forum.ansible.com/t/cannot-start-container-when-running-docker-task/20378>\
**Category:** Ansible Project\
**Created:** [January 29, 2016, 12:53am UTC](https://forum.ansible.com/t/cannot-start-container-when-running-docker-task/20378 "2016-01-29T00:53:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Knights](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Guy\_Knights](https://forum.ansible.com/u/Guy_Knights)\
**Post date:** [January 29, 2016, 12:53am UTC](https://forum.ansible.com/t/cannot-start-container-when-running-docker-task/20378/1 "2016-01-29T00:53:06Z")

</div>

I occasionally get the following error in some of my docker tasks, which stops ansible-playbook dead:

“changed”: true, “failed”: true, “msg”: “Docker API Error: Cannot start container 1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565: Error getting container 1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565 from driver devicemapper: Error mounting ‘/dev/mapper/docker-202:1-153569-1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565’ on ‘/var/lib/docker/devicemapper/mnt/1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565’: no such file or directory”

More often than not, if I re-run the same ansible-playbook command again it works fine. Has anyone encountered this, and if so did you manage to resolve it?

Thanks,  
Guy

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [January 29, 2016, 3:05am UTC](https://forum.ansible.com/t/cannot-start-container-when-running-docker-task/20378/2 "2016-01-29T03:05:18Z")

</div>

> I occasionally get the following error in some of my docker tasks, which  
> stops ansible-playbook dead:
> 
> "changed": true, "failed": true, "msg": "Docker API Error: Cannot start  
> container 1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565:  
> Error getting container  
> 1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565 from driver  
> devicemapper: Error mounting  
> '/dev/mapper/docker-202:1-153569-1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565'  
> on  
> '/var/lib/docker/devicemapper/mnt/1117bfd50795c71278d75e6f97ef1a1d67b5758658b57a5803ceffb28dea8565':  
> no such file or directory"
> 
> More often than not, if I re-run the same ansible-playbook command again it  
> works fine. Has anyone encountered this, and if so did you manage to resolve  
> it?

If you're getting a transient Docker API error, that's almost  
certainly not an issue with Ansible; it's likely that you're running  
Docker frequently enough to trigger some transient error. My guess is  
that you'd be running into that problem if you ran Docker repeatedly  
on the command line.

In fact, this issue looks a lot like what you're seeing:

[https://github.com/docker/docker/issues/4036](https://github.com/docker/docker/issues/4036)

Looks like a Docker race condition.

--g

---

<div class="post-metadata">

**Author:** ![Guy\_Knights](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Guy\_Knights](https://forum.ansible.com/u/Guy_Knights)\
**Post date:** [January 29, 2016, 8:25pm UTC](https://forum.ansible.com/t/cannot-start-container-when-running-docker-task/20378/3 "2016-01-29T20:25:23Z")

</div>

Ok, thanks Greg. I’ll follow up your lead.
