First off, I am new to Docker. I was able to create a container based off an image I had previously pulled, start it, but the container is stopped if the docker daemon or the host system are restarted.

So the question is, what is the next step (after creating a container) to make it persistent so that it is started automatically when the daemon is started or restarted?

Thank you in advance.

  • docker run --help | grep restart combined with a reading of the fine manual should get you going in minutes. May 29, 2019 at 16:46
  • @Zeitounator Thank you! You comment and the chosen answer were very helpful. Jun 1, 2019 at 16:51

1 Answer 1


You need to add a restart policy to your container.


docker run -dit --restart=always hello-world

In this example, I am telling docker to always restart the hello-world container no matter what happens (and also run it in the background interactively). If you do a docker ps, you will see it keeps restarting. To revert this, you need to update the container restart policy like this:

docker update --restart=no <CONTAINER_ID>
  • Glad to have been of help
    – gmolaire
    Jun 1, 2019 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.