For an existing standalone container, run docker update --restart=<policy> <container>. The change takes effect immediately. Use no, on-failure[:max-retries], always, or unless-stopped according to how the process should behave after exits, manual stops, and Docker daemon restarts.
Antihost offers VPS plans with one-click Docker, NVMe storage and a 14-day free trial.
Change the policy on an existing container
The --restart setting belongs to the container, so you can change it without deleting and recreating a container created with docker run. Replace the example name with a container name or ID.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →1. Find the container
List running and stopped containers so you can identify the target:
docker ps -a
The NAMES and CONTAINER ID columns provide the values accepted by docker update. Include -a; a stopped container will not appear in the default docker ps output.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
2. Apply the new policy
Run the update command with the policy you want:
docker update --restart=on-failure:3 my-app
The equivalent long command is:
docker container update --restart=on-failure:3 my-app
Docker documents that the new policy takes effect instantly after docker update runs. You do not need to recreate the container merely to change this setting.
3. Verify the setting and runtime state
Inspect the container and review its process state:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →docker inspect my-app
docker ps -a
In the inspection output, the restart-policy configuration is recorded with the container. The state section includes RestartCount, which records attempted automatic restarts, and StartedAt, which records the most recent start time. The second command shows whether the container is currently running or exited.
A policy change does not guarantee that a container stopped manually will start at that moment. Docker suppresses policy-driven restarting after a manual stop until the daemon restarts or you start the container yourself. If you intentionally stopped it, use:
docker start my-app
Choose the right restart policy
Docker’s standalone-container policies differ in which exits trigger a restart, whether attempts can be bounded, and how a manual stop interacts with a later daemon restart.
| Policy | Restart trigger | Retry limit | Manual stop | Docker daemon restart |
|---|---|---|---|---|
no |
No automatic restart, including after a process exits. | None. | The container remains stopped. | It is not configured for automatic restarting. |
on-failure |
Restarts when the container process exits with a non-zero status. | Unlimited unless written as on-failure:<max-retries>. |
A manually stopped container is not immediately restarted. | Daemon-restart behavior is not stated in the cited Docker guidance. |
always |
Restarts whenever the container stops, regardless of whether the process returned zero or non-zero. | Unlimited. | Docker suppresses the policy after a manual stop until the daemon restarts or the container is manually started. | A container stopped manually can be started when the daemon restarts, according to Docker’s documented behavior. |
unless-stopped |
Restarts whenever the container stops, regardless of exit status. | Unlimited. | The manual-stop state is retained. | A manually stopped container remains stopped after the daemon restarts. |
no: leave recovery to an operator
no is Docker’s default. It is appropriate when an exit should remain visible for investigation, when another supervisor owns the lifecycle, or when the container is intentionally short-lived. Set it explicitly on an existing container with:
Free tools Windows power users keep installed
One-click scans. No signup required.
docker update --restart=no my-app
With this policy, an exited process stays exited until someone runs docker start or another tool starts the container.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
on-failure: recover from errors, not clean exits
Use on-failure when a non-zero exit indicates a fault and a clean zero exit should be treated as complete. Without a suffix, Docker can keep attempting restarts:
docker update --restart=on-failure my-worker
Add a positive retry count when repeated failures should stop:
docker update --restart=on-failure:3 my-worker
That example permits up to three policy-driven restart attempts after failure. It does not turn a normal zero exit into a restart. A bounded policy is useful for a job that may recover from a transient fault but should eventually remain stopped for diagnosis.
always: keep the container running
always tells Docker to restart the container whenever it stops, including after a successful zero exit. Configure it with:
docker update --restart=always my-app
There is an important exception to the simple “always” wording: Docker recognizes a deliberate docker stop. The policy does not immediately undo that action. If the daemon later restarts, Docker’s documented behavior allows an always-managed container to start again.
unless-stopped: persist an intentional shutdown
unless-stopped behaves like always for unexpected exits but remembers that an operator stopped the container:
docker update --restart=unless-stopped my-app
After a manual stop, the container remains stopped even when the Docker daemon restarts. This is often the safer choice for services that should recover from crashes but must stay down after an administrator has deliberately taken them offline.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
How Docker spaces out restart attempts
Automatic restarting is not a tight, zero-delay loop. Docker documents an increasing backoff between attempts. The initial delay is 100 milliseconds; each subsequent failure doubles the delay until it reaches a maximum of one minute. These are Docker-documented runtime values, not an independent benchmark.
If the container runs successfully for at least 10 seconds, Docker considers that run successful and resets the backoff. A later failure therefore starts again at the initial delay rather than inheriting the previous long pause.
These timings matter when diagnosing a service that appears to be starting and stopping. Check docker ps -a repeatedly, then inspect RestartCount and StartedAt to distinguish a slow backoff from a container that never received the new policy.
Set a policy when creating a container
For a new standalone container, put the policy on the docker run command:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesdocker run -d --name my-app --restart=unless-stopped IMAGE
Replace IMAGE with the image reference you intend to run. Creation-time configuration avoids a window in which the container exists without its intended recovery behavior. The same four policy forms are available: no, on-failure[:max-retries], always, and unless-stopped.
Do not combine --rm with the expectation of a persistent restart policy. A container created with --rm is automatically removed when it exits, while a restart policy requires a persistent container to start again. Docker does not allow the restart policy to be updated on a --rm container.
Change the policy for a Docker Compose service
Compose stores the policy in the service definition rather than as a one-off command on an individual container. Add a service-level restart key to compose.yml:
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
services:
app:
image: example/app:latest
restart: unless-stopped
The service-level key accepts no, always, on-failure[:max-retries], and unless-stopped. For example, a bounded failure policy is written as:
Recommended Free Tools
services:
worker:
image: example/worker:latest
restart: "on-failure:3"
Quoting the value makes the colon unambiguous in YAML.
Apply an edited Compose file
After changing compose.yml, use a configuration operation such as:
docker compose up -d
Compose compares the declared configuration with the project and applies the change. Do not use docker compose restart as a way to load an edited YAML file. Docker explicitly notes that compose restart does not reflect configuration changes, including environment changes. It restarts containers with the configuration already applied to them rather than reconciling the edited file.
Once up -d has completed, inspect the resulting container if you need to confirm the effective policy, and use docker compose ps or docker ps -a to check whether the service is running.
Compose deployments that use deploy.restart_policy
Some Compose deployments use the deploy specification. In that model, restart controls are expressed under deploy.restart_policy, not the ordinary service-level restart key:
services:
app:
image: example/app:latest
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 60s
The deploy form can express a condition (none, on-failure, or any), a delay between attempts, a maximum attempt count, and an evaluation window. Its effect depends on the deployment target supporting the deploy specification. Treat it as a separate control from the service-level restart setting; do not assume that changing one changes the other.
Best Value
Change restart behavior for a Swarm service
A Swarm service is managed by the service scheduler, so the standalone-container command is not the right interface. Use docker service update and its Swarm-specific restart flags:
docker service update
--restart-condition on-failure
--restart-max-attempts 3
my-service
Swarm exposes four relevant controls:
--restart-conditionselectsnone,on-failure, orany.--restart-delaysets the delay between restart attempts.--restart-max-attemptsbounds the number of attempts.--restart-windowdefines the evaluation window used by the scheduler.
Use the standalone workflow for a container launched with docker run, the service-level Compose workflow for a Compose project, and the service-update workflow for a Swarm service. Mixing these command families is a common reason a policy appears not to change.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshoot a policy that appears not to work
The container was stopped manually
A manual stop is treated differently from a crash. Docker does not immediately restart a manually stopped container just because its policy is always or unless-stopped. Start it explicitly with docker start my-app. After a daemon restart, always may start it again, while unless-stopped preserves the stopped state.
The container was created with --rm
Check how the container was created. Automatic removal and a persistent restart policy are mutually exclusive, so Docker will not let you add a restart policy to a --rm container. Recreate it without --rm if it must be restarted automatically.
You edited Compose YAML and ran the wrong command
If the file contains the new restart value but behavior is unchanged, run docker compose up -d for the project. docker compose restart does not apply edited configuration. Confirm the service name and project directory before running the command.
You cannot tell whether attempts are occurring
Use docker inspect and look at RestartCount and State.StartedAt. A growing restart count indicates that Docker is attempting policy-driven restarts. The start timestamp helps show whether a new attempt occurred recently. Compare these values with docker ps -a, which reports the current lifecycle state.
The process exits successfully but you expected a restart
Review the policy. on-failure reacts only to a non-zero exit status. A process that exits with status zero will remain stopped under that policy. Choose always or unless-stopped when every stop, including a clean exit, should lead to another start.
The process fails forever and consumes repeated attempts
Use a bounded form such as on-failure:3 when automatic recovery should have a limit. Remember that Docker’s backoff still applies: attempts begin after 100 milliseconds, increase by doubling, and are capped at one minute. A run lasting at least 10 seconds resets that delay before a later failure.
A practical decision sequence
- Decide whether a zero exit should trigger another start. If yes, use
alwaysorunless-stopped; if no, consideron-failure. - Decide whether a deliberate stop must survive a Docker daemon restart. Choose
unless-stoppedwhen it must stay down. - Decide whether failure attempts need a ceiling. Add
:<max-retries>toon-failurewhen they do. - Identify the management layer: standalone container, Compose service, deploy specification, or Swarm service.
- Apply the matching command or configuration key, then verify with inspection and container-status output.
For a standalone container, the essential command remains:
docker update --restart=<policy> <container>
It changes the existing container immediately; the policy semantics determine what happens on the next exit, manual stop, or daemon restart.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




