Docker Port 18789 Conflict
When you see 'Bind for 0.0.0.0:18789 failed: port is already allocated', Docker is telling you that another process has already claimed port 18789 on your host machine. This prevents OpenClaw from binding its gateway port. The fix takes under 2 minutes: either identify and kill the conflicting process, or remap OpenClaw to a different host port. Neither option requires reinstalling anything.
π Error Message
Port 18789 is OpenClaw's default gateway port. You'll see this error in three scenarios: (1) A previous OpenClaw instance didn't shut down cleanly and the port is still held by a zombie process. (2) Another application on your machine happens to use port 18789. (3) You restarted Docker Desktop on macOS/Windows and the port release was delayed. Run the diagnostic command below to identify exactly which process is holding the port.
β Step-by-Step Fix
Run this command to get the PID (process ID) and name of whatever is holding the port. On macOS/Linux it will show the process name and PID directly. On Windows, note the PID from the last column, then run 'tasklist | findstr <PID>' to get the process name.
If the blocking process is a stale OpenClaw instance or something you can safely kill, terminate it with the PID from Step 1. Then start OpenClaw fresh. This is the cleanest solution if the conflict is from a zombie process.
If you can't kill the conflicting process (e.g., it's another application you need), remap OpenClaw to a free port. The left side of the mapping is the host port (what you expose), and the right side (18789) is the internal container port β leave that alone. Update your API clients or Nginx config to use the new host port.