Docker container restart policies
Written by
Updated at April 18, 2025
You can specify the Docker container restart policies in its description:
Always
: Always restart the Docker container when it stops. If you stop the Docker container manually, it only restarts along with the Docker daemon.Never
: Do not restart the Docker container automatically.OnFailure
: Restart the Docker container only if it shut down with a non-zero return code.
If the Docker container description in the metadata changed when restarting the VM, the specified restart policy will be ignored and a Docker container matching the new description will start.
Use cases
- Transferring logs from Container Optimized Image to Yandex Cloud Logging
- Running a containerized app in Yandex Serverless Containers
- Creating a VM from a Container Optimized Image with multiple Docker containers
- Creating an instance group from a Container Optimized Image with multiple Docker containers