Port 4000 already in use?

Hello there.

I have being following “The Ultimate Guide to Local AI and AI Agents (The Future is Here)”.

Installing this in ubuntu 25.04 the script crashes complaining that I already have port 4000 in use. Has anybody else seen this and what can I do to move on?

Here is the last part of the script output:

I found the problem.

docker-desktop are running in a virtual environment and docker engine is running natively.

This means I had two docker instances on my machine, which caused a conflict for port 4000 (and for pass-through for my GPU for ollama)

  • Docker Engine (native)/var/run/docker.sock
  • Docker Desktop (VM) → own socket and runtime

Hope this is helpful for anybody struggling with similar problem.

1 Like

Honestly it should detect this and increment the port on run automatically (should be a simple fix). But also, you should be able to set this when running with pnpm run dev – –port 4001. Good luck!