October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

Docker Containers Keep Crashing? Diagnose the Exit Before Scaling

A Docker restart loop is a symptom, not a diagnosis. Check the container’s exit state and logs, then compare restart behavior, resource limits, and host capacity before changing settings.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Docker container that exits during a multi-agent workload is not automatically undersized. First capture its exit state, logs, restart count, host resource use, and configured limits; those clues distinguish an application failure from memory pressure, a restart loop, or a daemon or host problem. Changing limits or adding hardware before checking them can mask the cause—or make it worse.

First, identify what “crashing” means

That description can refer to several different events: the container’s main process exits once, Docker restarts it repeatedly, an orchestrated service reports an unhealthy state, or the Docker daemon or host itself stops. These are not interchangeable, and the phrase “multi-agent system” does not identify a particular framework or failure mechanism.

As an Amazon Associate I earn from qualifying purchases.

Before changing the deployment, preserve the stopped container and collect its state. By default, its filesystem remains after exit, which may help with debugging. Start with the container list, then inspect its state and logs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker ps -a
docker inspect <container>
docker logs <container>

Use the container name or ID in place of <container>. Record the exit code, whether it is currently running, restart count, last-start information, and any configured resource limits. Compare the timestamps in the logs with the exit or restart time; the last visible application message may be more useful than the restart status alone.

What the exit code and logs can tell you

Docker’s running containers guide distinguishes some Docker-level errors from the command’s result. Exit code 125 indicates an error with the Docker daemon; 126 means the specified command could not be invoked. Other exit codes may be the container command’s own exit status, so interpret them with that command’s logs and context rather than assuming a universal meaning.

In particular, do not treat exit code 137 alone as proof of an out-of-memory kill. The evidence here does not establish that interpretation. Check the container state, application output, resource use, and host or daemon evidence together.

If the logs show the application reporting a configuration error, failed dependency, or other explicit problem, investigate that service’s command and configuration before changing Docker limits. If the logs end abruptly, that is a clue to correlate with resource and host events, not a diagnosis by itself.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Check memory limits and host memory pressure

Docker’s resource constraints documentation says containers have no resource constraints by default: they can use resources as allowed by the host kernel scheduler. A configured hard memory limit caps a container’s memory. A memory reservation is a soft limit that matters under host contention; it is not a guaranteed ceiling.

Docker documents a minimum hard memory limit of 6 MB. That is a CLI constraint, not a recommended allocation for an application. Choose a limit only after measuring what the workload needs and checking what the host can supply. An undersized hard limit can result in termination; raising it without considering host capacity can shift pressure onto other workloads or the host.

During an out-of-memory event, the kernel can kill processes in a container. If the host runs out of memory, the kernel’s OOM killer can stop a container or the Docker daemon. Check host memory pressure alongside container-level limits rather than assuming the container is the only affected component. Docker recommends allowing adequate host memory, testing application requirements, and setting limits where appropriate.

Disabling OOM killing is not a general fix. Docker warns that using --oom-kill-disable without a memory limit can put host processes at risk.

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

Understand memory and swap settings

Docker’s --memory-swap setting represents total memory plus swap when used with --memory. In Docker’s documented example, --memory=300m and --memory-swap=1g allow 300 MB of physical memory plus 700 MB of swap. Frequent swap use can hurt performance, and swap-limit support may be unavailable in a kernel; Docker notes that this can produce a warning. Do not assume swap is enabled or available on a particular host.

Check CPU constraints without mistaking slowness for a crash

CPU shares are relative weights that affect allocation when CPU-intensive containers compete. They do not reserve a fixed amount of CPU when there is no contention. By contrast, --cpus or a CPU quota imposes a limit. These settings can constrain throughput or increase latency, but CPU pressure alone does not prove why a process exited.

Compare the container’s configured CPU settings with observed host contention and the application’s behavior around the exit. If the process is slow but remains alive, that is a different problem from an exit-and-restart cycle; do not use a crash fix for a performance symptom.

Use restart counts to understand the loop

A restart policy determines what Docker does after a container exits; it does not explain why the process exited. Docker documents four choices in Start containers automatically:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Policy What it does
no Default; does not automatically restart the container.
on-failure[:max-retries] Restarts after a non-zero exit status; an optional maximum caps retries.
always Restarts the container automatically after it exits, subject to Docker’s documented behavior for manual stops and daemon restarts.
unless-stopped Restarts automatically unless the container has been manually stopped; its behavior differs from always after manual stops and daemon restarts.

Docker adds a delay between repeated restart attempts: it begins at 100 milliseconds, doubles up to a maximum of one minute, and resets after the container has run successfully for at least 10 seconds. Inspect the restart count with:

docker inspect -f '{{ .RestartCount }}' <container>

Also inspect the container’s start-time information to place the attempts on a timeline. A rising count tells you Docker is retrying, not whether the cause is a failing command, resource pressure, or something else. Changing the policy can alter retry behavior, but it will not repair an application bug, missing configuration, resource shortage, or failed dependency.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

For Compose deployments, inspect the service view

If the workload is defined with Docker Compose, use its service-level status and logs to see how the multi-container application is behaving:

docker compose ps
docker compose logs

Compose is a tool for defining and running multi-container applications. Its overview describes commands for starting, stopping, and rebuilding services, viewing service status, streaming logs, and running a one-off command. These checks are relevant only if this deployment uses Compose; “multi-agent” does not establish whether it does.

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

Choose an intervention that matches the evidence

Evidence Intervention to consider Scope and trade-off
Exit status and application logs point to the process or its configuration. Fix the affected command, application, configuration, or dependency. Targets the failing service rather than changing the entire host.
Measurements show the container’s memory cap is below demonstrated workload needs, and the host has capacity. Adjust the hard memory limit based on measured need. A higher cap gives the container more headroom but does not create host memory; an undersized cap can lead to termination.
Host measurements show insufficient capacity for the workload. Evaluate host capacity or workload placement. Additional capacity is relevant only when measurements establish a host shortfall; it is not a default fix for an unexplained exit.
The container exits and Docker retries it, but the cause is still unknown. Use the restart count and timeline as diagnostic evidence before changing policy. Restart policy changes post-exit behavior, not the underlying failure.
Daemon, runtime, kernel compatibility, or kernel-module evidence points below the application layer. Investigate the Docker daemon and host configuration. Keep this branch evidence-led; it is not the usual first assumption for every container exit.

When to investigate Docker or the host

If the evidence points to daemon or kernel behavior rather than an application process, consult Docker’s daemon troubleshooting guidance. It discusses kernel compatibility and missing kernel modules; its linked compatibility-check script works only on Linux. The documentation also covers swap-accounting support and notes host overhead from enabling memory and swap accounting in its Ubuntu and Debian guidance.

Use those checks when the observed error or host configuration makes them relevant. A container exit by itself does not establish a kernel compatibility problem.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.