I’ve struggled to resolve an error when trying to start my MongoDB container on a Windows 11 machine. Suddenly after running docker-compose to build and create my containers the MongoDB container failed to start with the following error.
“error starting userland proxy: bind for 0.0.0.0:xxx failed: port is already allocated”
The error is obvious that the port is already allocated, which wasn’t true in my case.
I’ve searched the whole internet for a solution but none was working especially the ones saying to kill the process using that port.
How I resolve it?
The solution is very simple:
- Stop all containers
- Shutdown docker desktop (if you have one)
- Go to your users folder on your Windows machine
- Find the folder for the logged in user
- Open it and inside find folder “.docker”
- Delete it
- Restart docker
- Run your commands
This is how I resolve this and I hope that I helped you too.