Fix: “docker: command not found” While Updating Ollama (Beginner Guide)
Introduction
I recently tried updating Ollama on my VPS.
Everything seemed straightforward — until I ran:
docker ps
And got this:
docker: command not foundDocker was already installed.
Ollama was running fine.
So why wasn’t the command working?
It turns out, this wasn’t a Docker issue.
It was a mental model problem.
The Real Problem
I was inside a Docker container.
root@62aaf53zze3a9c8:/#And I was trying to run Docker commands from there.
That doesn’t work.
Understanding the Key Concept (This Changes Everything)
When you work with Docker, you’re dealing with two layers:
Host (Your VPS / System)
- Has Docker installed
- Controls containers
- Runs commands like
docker ps,docker run, etc.
Container (Where Ollama Runs)
- Has Ollama
- Does NOT have Docker
- Runs application-level commands
Important rule:
| Task | Where to run |
|---|---|
| Docker commands | Host |
| Ollama commands | Container |
| API calls | Anywhere |
Why You See “docker: command not found”
Because you are trying to run:
docker psInside the container.
But Docker only exists on the host machine, not inside containers.
Step-by-Step Fix
Step 1 — Exit the container
exit
root@srv9zz99258:~#
Step 2 — Confirm you’re on the host
docker ps
Step 3 — Stop and remove old container
docker stop ollama
docker rm ollama
Step 4 — Pull the latest Ollama image
docker pull ollama/ollama:latest
Step 5 — Run updated container
docker run -d \
--name ollama \
-p 11434:11434 \
-v ollama:/root/.ollama \
ollama/ollama:latest
Step 6 — Verify models
docker exec -it ollama ollama listYour models (like gemma3, qwen, etc.) should still be there.
Step 7 — Run a model
docker exec -it ollama ollama run qwen3.5:0.8bWhat I Learned (The Real Insight)
This wasn’t a technical issue.
It was a thinking issue.
I was trying to control Docker from inside a container.
Instead of:
Controlling containers from the host.
Final Takeaway
Whenever something feels broken in Docker, ask yourself:
👉 “Am I on the host or inside the container?”
That one question can save hours.
Conclusion
If you’re running Ollama using Docker:
- Keep Docker commands on the host
- Keep Ollama commands inside the container
Once you understand this separation, everything becomes much easier.
🚀 If you found this useful, don’t forget to share it with fellow Product Managers and AI Enthusiasts!
Recent Posts
- Fix: “docker: command not found” While Updating Ollama (Beginner Guide)
- 🧠 I Built a Telegram Weather Bot Using n8n + LLM + OpenWeather (And Here’s What I Learned)
- Installing Docker as a Product Manager: From “Out of Scope” to “I Should Try This”
- Installing Docker Desktop on my Ubuntu 24.04 — A Product Manager’s Learning Journal