Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A zero exit code means one process run finished without error. It does not tell the platform to leave the container alone. If the restart policy says to restart after any termination, a container that exits cleanly every time will be started again, and the restart count keeps climbing. A count of 39,352 with only exit code 0 on record is consistent with that pattern. The title does not name the platform, though, so the mechanics below use Kubernetes and Docker as the two most common examples, and the final section explains what the count alone cannot show.

What exit code 0 does and does not mean

An exit code is the status a process returns when it stops. Code 0 means the process ended without an error from its own point of view. It says nothing about whether the container should keep running. That decision belongs to whatever supervises the container, such as the kubelet in Kubernetes or the Docker daemon, and that supervisor applies a restart policy.

So the two facts can both be true at once: the process succeeded on every run, and the supervisor restarted it tens of thousands of times. A command that finishes its work in a second, under a policy that treats every stop as a reason to start again, produces exactly this loop.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restart policy decides whether success triggers a restart

In Kubernetes, the Pod field restartPolicy controls this. The official Kubernetes Pod Lifecycle documentation states that “the restartPolicy for a Pod applies to app containers in the Pod and to regular init containers.” Its comparison table for exit code 0 gives the following behavior:

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
Pod restartPolicy Container exits with 0 Container exits with non-zero code Typical workload
Always (default) Restarts Restarts Long-running service that should never stop
OnFailure Does not restart Restarts Finite task that should retry real errors
Never Does not restart Does not restart Task that should run once and be inspected

The same Pod Lifecycle table also lists sidecar containers, and in its exit-code-0 row a sidecar container is shown as restarting. If a sidecar in your Pod is the one exiting cleanly, the cycle can come from that container rather than the main application.

The key point for this incident is the first row. Under Always, the platform has no concept of a job being finished. Any termination, successful or not, schedules another start.

Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.

What CrashLoopBackOff actually signals

Kubernetes reports a container that keeps restarting with the status CrashLoopBackOff. The label describes a delay, not an error code. Kubernetes waits longer before each successive restart of the same container, and the status shows that waiting period is in effect. A container can show CrashLoopBackOff after clean exits, and that is the situation this title describes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The documented values for Kubernetes are:

  • The first restart delay is 10 seconds, and the delay grows exponentially on each repeat (10, 20, 40, 80, 160 seconds).
  • The delay is capped at 300 seconds, which is five minutes.
  • The kubelet resets the backoff after 10 minutes of uninterrupted successful execution.

These are platform behavior values. At the cap, a container that exits immediately each time can restart about 288 times per day (86,400 seconds divided by 300). The count of 39,352 is far beyond that pace, which means the restarts were not all happening at the capped rate. The record that would explain the timing is the Pod’s event history and the timestamps on each restart, which are covered below. Also note that the backoff resets after 10 minutes of stable running, so a container that stays up briefly and then exits will restart again quickly.

Rank #3
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

How to confirm the policy in a Kubernetes Pod

Work through these steps in order. Each one narrows the cause before you change anything.

  1. Read the configured restart policy. Run kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.restartPolicy}'. If the output is Always, or the field is empty (which defaults to Always), any clean exit causes a restart.
  2. Check the controller. Run kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.metadata.ownerReferences[0].kind}'. A Pod owned by a Deployment is expected to stay running. A Pod owned by a Job is expected to finish.
  3. Read the last termination state. Run kubectl describe pod <pod-name> -n <namespace> and find the container’s Last State block. It shows the reason, the exit code, and the start and finish timestamps. Confirm that every entry reads exit code 0 with a short run time.
  4. Review recent events. The same describe output ends with an Events section. Look for repeated Pulled, Started, and BackOff entries, and for probe failures that could be stopping the container.
  5. Read the logs from the terminated run. Run kubectl logs <pod-name> -n <namespace> --previous. The --previous flag returns output from the last instance that stopped, which is the one that exited. Look for the final message the process printed before it finished.
  6. Check the command and its environment. Confirm whether the entrypoint is expected to finish or to stay in the foreground, whether required environment variables and mounted files are present, and whether liveness or startup probes are killing a process that is otherwise healthy.

Once you have the policy and the controller, the right fix follows directly. If a service-style process is exiting after its work is done, the usual cause is a command that runs once and returns, or a process that daemonizes and leaves the foreground. In that case the fix is in the image or the command, not the restart count.

Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Docker restart policies compared

If the container runs under Docker rather than Kubernetes, the policy is set with the --restart flag or in the container’s configuration. Docker’s documented values are:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Docker policy Restarts after exit code 0 Restarts after non-zero exit Honors a manual stop
no (default) No No Not applicable
on-failure[:max-retries] No Yes, up to the optional retry limit Not stated as a separate rule
always Yes Yes Restarts whenever the container stops
unless-stopped Yes Yes Yes, a manual stop is kept

Docker applies a restart policy only after the container has started successfully, which Docker defines as running for at least 10 seconds. A container that exits within that window is not treated as a successful start. Check the policy with docker inspect -f '{{.HostConfig.RestartPolicy.Name}} {{.RestartCount}}' <container>, which prints the configured policy and the restart count together. Docker and Kubernetes use different field names and lifecycle details, so do not assume one platform’s settings carry over to the other.

Best Value
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Choosing the right setup for the workload

The restart policy should follow from what the container is supposed to do. The same clean exit is a bug for one workload and the intended result for another.

Finite work: use a Job

A batch script, a migration, or a report generator finishes by design. Run it as a Kubernetes Job rather than as a bare Pod or Deployment. Jobs commonly use OnFailure or Never as the Pod restart policy. The Job’s own backoffLimit field controls how many retries the Job makes after failures. Retries at the Job level and restarts at the Pod level are separate mechanisms, so set both deliberately. A Job that succeeds is marked complete and is not restarted.

Long-running services: keep the process in the foreground

A web server or queue consumer should run its main process in the foreground and keep that process alive. A Deployment with the default Always policy is designed for this case. If such a container exits cleanly, the supervisor restarts it, which is correct behavior for a service that should never stop. The defect is that the process stopped, so the fix belongs in the application or in its startup command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the count and exit code cannot tell you

A restart count and a list of exit codes show that the cycle happened. They do not show why each run ended. Confirming the cause requires:

  • The Pod or container manifest, including restartPolicy, the owning controller, and the exact command and arguments.
  • The termination reason, exit code, and timestamps for the recent runs, from kubectl describe pod or the equivalent Docker inspection output.
  • The container logs from the terminated runs, not only the current one.
  • The Pod’s event history over the same period, including any probe failures and image pulls.

Until those records are available, any diagnosis of a specific incident remains conditional. The general mechanism described here, a clean exit followed by a policy-driven restart and backoff, is well documented for Kubernetes and Docker. Whether it is what happened to your container depends on the policy and command in place at the time.

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$188.90
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$259.29
SaleBestseller No. 5
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.99

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.