New Tool Radar

Local AI

How to Fix a LocalAI Container That Exits at Startup

Read the LocalAI container logs and fix the startup failure, from the health check to the volumes.

Schematic illustration with three step boxes: See the exit; Read the logs; Fix the cause.

A LocalAI container that starts and then exits usually leaves its reason in the logs. The official troubleshooting guide starts with three checks: the container status, the logs, and the readiness endpoint. This guide runs those checks and fixes the most common causes.

Before you start

  • Docker installed, with a LocalAI container that exits.
  • A terminal with docker and curl.
  • The docker run command or compose file you used to start LocalAI.

See how the container exits

List all containers, including stopped ones:

docker ps -a | grep local-ai

Note the exit code. An exit code of 0 can mean the process finished normally, which points at a missing command or a config that tells it to stop; a non-zero code points at a crash, and the logs will say why.

Read the logs

Read the container logs:

docker logs local-ai

Look at the last lines first. Common causes are a missing or unreadable model file, a bad volume mount, and a GPU that is not visible to the container. If the logs are empty, run with debug logging on, using DEBUG=true or –log-level=debug.

Fix the cause and check readiness

Fix what the log names: remount a missing volume, fix a permission on the models folder, or pass –gpus all if the GPU is missing. Since version 3, LocalAI downloads each inference backend separately into /backends, so a fresh container also needs network access on first start. Then start the container and check readiness:

curl http://localhost:8080/readyz

A 200 answer means the server is up.

Worked example

Worked example: the logs say the models folder cannot be read. Check the mount with docker inspect local-ai, fix the host path, and start the container again. The readiness check should answer 200, and the model list should load in the web interface.

Expected result

UNTESTED in this guide: no container was run while writing it. The expected result is that the logs name the cause, the fix is applied, and /readyz answers 200.

Limitations

Do not keep restarting the container without reading the logs: the same failure will repeat, and a container started with –rm deletes its logs when it exits. Keep the logs from the first failure before trying the next fix.

Sources

See all