Docker containers restart policies

the restart policy unless-stopped restart a container unless it is manually stopped.
I have ran a container with this policy on my host and i have restarted docker to test out.
and my docker container got restarted using this policy .
in one of the research questions a particular question was Which policy would restart the containers even after the docker daemon is restarted?
i have selected the answer as always and unless-stopped but my answer was marked as wrong aas the correct answer is always.
am i missing something?

Kindly provide me with the exact question you mean and send me the link to the research questions.

https://kodekloud.com/courses/1203948/lectures/26929152. Question number four.
i am sorry for the late reply.

Hello @Wabou12
Yes, the right answer is “always” since the difference between “always” and “unless-stopped” is that using the second one Similar to “always” , except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.

Hello @Ayman, the question is Which policy would restart the containers even after the docker daemon is restarted? it doesn’t specify if the container was stopped if u run a container with unless-stopped policy and u run the service docker restart the container is restarted.
tht’s my main confusion.

Let’s assume that you stopped a container with a policy always, then restart the docker daemon. this container will start again. Assume that u have a running container with unless stopped policy, then u restarted the docker daemon. this container will be starting again and same case for always policy. the last case, assume that u have a running container with unless stopped policy, u stopped this container, then restart the docker daemon, this container will not starting again.