Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My app keeps restarting on the server

Short answer

A container that restarts again and again is crashing on start, and a restart policy is bringing it back each time. The policy hides the crash but does not fix it. Do not delete containers or volumes. Ask your engineer for the container logs, which usually say why.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • My site goes up and down every few minutes.
  • The server is slow and the status shows restarting.
  • It worked until a setting was changed or an update was run.
  • The disk is nearly full.
  • Only one part, such as the database or the API, keeps dropping.

Why does this happen?

  1. A restart policy keeps bringing a failing app back

    Docker documents restart policies that start a container again after it stops, for example when it exits with an error. It says a policy takes effect only after the container has started successfully. So a loop is a sign the app itself is failing, over and over.

  2. Wrong or missing settings

    A changed password, an environment value or a missing file makes the app exit at start.

  3. The machine ran out of space or memory

    A full disk or full memory stops databases and apps, and the policy restarts them into the same wall.

  4. A dependency is not ready

    An app that starts before its database is available exits, then repeats.

What can I do about it today?

  1. Do not delete containers, images or volumesVolumes hold your data. Deleting them to start fresh can destroy it.
  2. Do not keep rebooting the serverIt does not fix the cause and can corrupt data if a database is writing.
  3. Ask for the container logsAsk your developer or host to send the last lines from the failing container. They usually name the reason.
  4. Check disk spaceAsk whether the disk is nearly full. It is a common and quick-to-confirm cause.
  5. Tell your engineer what changed lastAn update, a new setting, a server move. The last change is often the cause.

When should I bring someone in?

  • The loop affects a database or anything that holds customer data.
  • Your site is down for customers.
  • Nobody can read the logs.

How do I handle it?

  1. Back up before touching anythingVolumes and the database are copied out first.
  2. Read the logs and the exit reasonI find why the container stops and what changed before it began.
  3. Fix the cause, not the policySettings, space, memory or start order are corrected, then the container is allowed to run on its own.
  4. Add a warningAn alert tells you when a container restarts, instead of a customer telling you.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Should I turn the restart policy off?

Not as a first step. It keeps the app up when something brief fails, and Docker says it applies after a successful start.

Is my data lost?

Usually not, unless volumes were deleted. That is why I ask you not to remove them.

Can this happen again?

Yes if the cause is not removed, so I add checks and an alert.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.