Some Container exited after host machine reboot, some are running

Hello,

I have DockerDesktop 4.35.1 running and see the following behavior on Win 10 running DockerDesktop/WSL2 with distro Ubuntu.

If I reboot the complete Windows host some containers (that were running before) are in exited state after reboot, some are started automatically.

If I reboot only DockerDesktop all containers are running after.

In the docker-compose.yml file all containers have “restart: unless-stopped” set.

Does anyone maybe have an idea how to solve this?

Thanks and bye, Peter

Hello,

I updated Docker Desktop to version 4.36.0 and I see the same problem.

I also set all containers to restart: always but this doesn’t solve the problem.

In the container logs I see nothing that could be the reason

Does anyone maybe have another idea?

Thanks and bye, Peter

Hmm… “always” should mean “always”. Containers could fail and constantly restart, but not remaining stopped.

When you changed the restart policy to always, did you run docker compose up -d again?

You could check the restart policy of the container that yu see stopped this way:

docker container inspect CONTAINERNAME --format '{{ json .HostConfig.RestartPolicy }}'

It should return a json like this:

{"Name":"always","MaximumRetryCount":0}

As you cans ee, there is a MaximumRetryCount. If it is set, if some containers have dependencies that are not running yet or not ready for connection, the container could fail too many times. If the value is 0, the container should always restart and you should see it is restarting and not that it is stopped.

1 Like

Hello Rimelek,

yes, after changing restart policy to restart: always I did run “docker compose up -d” again

And I checked the MaximumRetryCount, it is 0 for all my containers.

Unfortunately I have no idea where to continue, any idea?

Thanks and bye, Peter