Search code examples
dockerboot2docker

Couldn't start exited docker container after restart of host machine


I unexpectedly shut down my host machine and when turned it on again all my docker containers became exited.

I can see them using docker ps -a

I cant start any of them using docker start {container_id}

I get this error:

Error response from daemon: Cannot start container cc61efa31df8: [8] System error: not a directory
Error: failed to start containers: [cc61efa31df8]

Has anyone ever tried to start exited container?

I don't want to remove and recreate containers because I have some data on mysql container.

I'm on Mac, using parallels driver for docker.


Solution

  • Although @Thanh Nguyen Van's answer helped me to understand the problem I'm not marking it as a correct one because it seems initial problem stays unresolved.

    I used docker inspect and located database volumes.

    I checked them and they where empty, which makes me think that volumes where destroyed/deleted after shutdown and this is correct according to boot2docker documentation.

    Changes outside of these directories will be lost after powering down or restarting the VM - to make permanent modifications see the FAQ.

    So there is nothing wrong.

    If anyone wants to persist data between restarts of docker-machine just make sure that you map database files to your host machine, so newly started docker-machine will mount your mapped folders as a container volume.