Sobes.tech
Junior — Middle

Will the container continue to work after the host system reboots?

sobes.tech AI

Answer from AI

By default, Docker containers do not continue running after the host system is rebooted; they stop along with it. To have a container automatically start after a reboot, you need to set a restart policy.

For example, when running a container, you can specify the parameter:

docker run --restart unless-stopped ...

Possible values for --restart:

  • no — do not restart (default)
  • on-failure — restart on errors
  • always — always restart the container
  • unless-stopped — restart unless the container is manually stopped

If a restart policy is set, Docker will automatically start containers with the specified setting after a host reboot.