Skip to content

Ollama Memory Configuration

When running Ollama on xCloud, you may encounter memory errors like:

500: model requires more system memory (4.5 GiB) than is available (2.0 GiB)

This happens because the Ollama Docker container has a memory limit (often 2GB by default), even if your server has more RAM available.

  • SSH access to your xCloud server (see SSH Setup)
  • Access to the Server Command Runner in xCloud dashboard

Run via SSH or the xCloud Command Runner:

Terminal window
docker inspect $(docker ps -q --filter name=ollama) | grep -i memory

Look for the "Memory" value. 2147483648 = 2GB, which is often too low for larger models.

Different models require different amounts of RAM:

  • llama2-uncensored (7B): ~4.5GB
  • deepseek-r1:1.5b: ~2GB
  • llama2:13b: ~8GB
  • llama2:70b: ~40GB+

Step 1: Get Current Container Configuration

Section titled “Step 1: Get Current Container Configuration”

Save the volume mount path before removing the container:

Terminal window
docker inspect ollama-your-domain.com --format '{{range .Mounts}}{{.Source}}:{{.Destination}}{{"\n"}}{{end}}'

Example output: /var/www/your-domain.com/data:/root/.ollama

Terminal window
docker stop ollama-your-domain.com && docker rm ollama-your-domain.com

Replace <VOLUME_PATH> with your path from Step 1:

Terminal window
docker run -d --name ollama-your-domain.com --memory=12g --restart unless-stopped -p 127.0.0.1:18016:11434 -v <VOLUME_PATH>:/root/.ollama ollama/ollama:latest

For example:

Terminal window
docker run -d --name ollama-your-domain.com --memory=12g --restart unless-stopped -p 127.0.0.1:18016:11434 -v /var/www/your-domain.com/data:/root/.ollama ollama/ollama:latest
Terminal window
docker inspect ollama-your-domain.com --format '{{.HostConfig.Memory}}'

Should return 12884901888 (12GB).

After recreating the Ollama container, Open WebUI may lose connection because the container is no longer on the same Docker network.

Terminal window
docker inspect $(docker ps -q --filter name=openweb) --format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}'
Terminal window
docker network connect --alias ollama <NETWORK_NAME> ollama-your-domain.com

For example:

Terminal window
docker network connect --alias ollama your-openwebui-network-name ollama-your-domain.com

The --alias ollama is important because Open WebUI is configured to connect to http://ollama:11434.

In Open WebUI:

  1. Go to Admin Settings > Connections
  2. Click the refresh button next to the Ollama API URL
  3. You should see “server connection verified”

The --memory=12g flag sets a ceiling, not a reservation:

  • Ollama can use up to 12GB, but only consumes what it actually needs
  • Other apps can freely use any RAM that Ollama isn’t actively using
  • No memory is pre-allocated or blocked from other containers

Your server’s total RAM should be higher than the sum of all container limits to avoid the OOM (Out of Memory) killer terminating containers.

”Failed to fetch models” in Open WebUI

Section titled “”Failed to fetch models” in Open WebUI”

The Ollama container isn’t reachable. Check:

  1. Container is running: docker ps | grep ollama
  2. Container is on the correct network (see Reconnecting section above)

Verify the container was recreated with the new limit:

Terminal window
docker inspect ollama-your-domain.com | grep '"Memory"'

If it still shows 2GB, the container wasn’t properly recreated.

Check Docker logs:

Terminal window
docker logs ollama-your-domain.com