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 Docker container that exits during a scaling attempt is not automatically short on memory or host capacity. First identify whether its process exited, Docker restarted it, a service became unhealthy, or the daemon or host stopped. Capture the exit state, logs, restart count, resource limits, and host pressure before changing settings or adding hardware.

What does “crashing” mean in this deployment?

Scaling a multi-agent workload can make failures more visible, but “crashing” can describe several different events: an application process exits once; Docker restarts an exited container; a service is unhealthy while its process remains alive; or the Docker daemon or host stops. Those cases require different fixes. The name “multi-agent” does not identify a particular framework or deployment design, so start with the container and host evidence rather than assuming a cause.

Preserve the stopped container while you investigate. By default, its filesystem remains after exit, which can help with debugging. Avoid removing or recreating it until you have collected its state and logs.

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

Collect the first clues: status, exit state, and logs

For a standalone container, use these checks to find the stopped container, inspect its state, and read its output:

docker ps -a
docker inspect <container>
docker logs <container>

Docker documents exit code 125 as an error with the Docker daemon and 126 as a specified command that cannot be invoked. Other exit codes may be the exit status returned by the command running in the container. An exit code by itself is not a complete diagnosis: pair it with the application logs and the container’s inspected state. See Docker’s Running containers guide.

For a deployment managed with Compose, inspect service status and logs from the project directory:

docker compose ps
docker compose logs

Compose is intended for defining and running multi-container applications; it can show running service status, stream logs, start or stop services, rebuild them, and run a one-off command. Use it only if this workload is actually managed with Compose. The Docker Compose overview describes those capabilities.

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

Check memory pressure and configured limits

Docker containers have no resource constraints by default; they can use resources as allowed by the host kernel scheduler. Docker supports hard memory limits and soft reservations. A hard limit caps container memory, while a reservation is a soft limit relevant under host contention—not a guaranteed ceiling. Docker documents a minimum hard memory limit of 6 MB; that is a CLI constraint, not a sensible application allocation recommendation. See Docker’s resource constraints documentation.

Memory exhaustion can terminate a process inside a container. If the host runs out of memory, the kernel’s OOM killer may stop a container or the Docker daemon. Check both the container’s configured limits and host memory pressure before raising a limit: a higher container cap cannot create host capacity, and an undersized cap can cause termination. Docker recommends providing adequate host memory, testing application requirements, and setting limits appropriate to the workload. Do not disable OOM killing casually; Docker warns that doing so without a memory limit can put host processes at risk.

Understand memory and swap together

Docker’s --memory-swap setting represents total memory plus swap when used with --memory. In Docker’s documented example, --memory=300m with --memory-swap=1g allows 300 MB of physical memory plus 700 MB of swap. Swap can carry a performance penalty when used frequently. Do not assume swap accounting is available: Docker notes that missing kernel support can produce a warning.

Check CPU constraints without mistaking slowness for a crash

CPU shares are relative weights that matter when CPU-intensive containers compete. They do not reserve a fixed amount of processor time. By contrast, --cpus or a CPU quota can impose a limit on a container. A constrained workload may become slower or less responsive, especially when several services compete, but CPU throttling alone is not proof of why a process exited. Check the configured CPU settings alongside the exit state and application logs. Docker documents these distinctions in its resource constraints guide.

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

Use restart counts to understand the timeline

A restart policy describes what Docker does after a container exits; it does not explain why the process exited. Inspect the restart count and last start time as timeline clues:

Best Value
Docker Container Linux Devops Programming Coding T-Shirt
  • Docker, Docker Swarm, Docker Compose, Programmer, Developer, Coding, Programming, Software Engineer, Code, DevOps, Deploy, Deployment, Kubernetes, Salt, Puppet, Chef, Terraform, Container, AWS, Azure, Cloud, Geek, Funny, Computer, Software, Tech, IT
  • Integration, Scrum, Compile, Compilation, Science, Bug, Debug, Python, Linux, Java, Javascript, Scala, Dotnet, Kotlin
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
docker inspect -f '{{ .RestartCount }}' <container>
docker inspect <container>

In the inspection output, check the container’s state and its last start information as well as the restart count. Docker offers four restart policy choices:

  • no (the default): do not automatically restart the container.
  • on-failure[:max-retries]: restart after a non-zero exit, optionally limiting retries.
  • always: automatically restart after exit, with behavior affected by manual stops and daemon restarts.
  • unless-stopped: restart unless the container has been manually stopped.

Docker increases the delay between repeated restarts, starting at 100 milliseconds and doubling up to a maximum of one minute. If a container runs successfully for at least 10 seconds, the delay resets. These are restart mechanics, not evidence that a restart policy has fixed an application bug, missing configuration, resource shortage, or dependency failure. See Docker’s restart policy documentation.

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

Match the intervention to the evidence

Evidence points to Intervention to consider Scope and trade-off
Application logs or command exit status show the process itself is failing. Fix the application, command, or configuration. Targets the affected service rather than changing the whole host.
Measured memory need and host capacity show the container limit is unsuitable. Adjust the container resource limit after measuring workload needs and available host capacity. A hard cap can protect the host, but an undersized cap can terminate the workload. A soft reservation is not a hard cap.
Measurements show the host cannot meet the workload’s resource needs. Consider a host capacity change. Additional hardware is not a default fix; first establish that capacity is the constraint.
The problem is the post-exit retry behavior. Choose a restart policy that matches the service’s recovery needs. Changes retry behavior, not the underlying cause.
Daemon, runtime, kernel compatibility, or kernel-support evidence indicates a platform issue. Investigate Docker daemon and host/kernel compatibility. Applies when platform evidence points there, rather than as the first assumption.

When to investigate Docker or the host

If the exit state or logs suggest the daemon, runtime, or host rather than the application, review Docker’s daemon troubleshooting guidance. It discusses kernel compatibility and missing kernel modules; its compatibility check script is for Linux only. The guidance also covers swap accounting and notes host overhead in its Ubuntu and Debian instructions for enabling memory and swap accounting. Treat these as platform-specific avenues when the evidence points to them, not as the default explanation for a container exit. See Troubleshoot the Docker daemon.

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

Docker Engine, CLI, Compose, and host-kernel behavior can vary by installed version and platform. Record those details alongside the failure state when troubleshooting a deployment, especially before applying version- or kernel-specific changes.

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.