A previously working app suddenly fails to start with "port is already allocated"
Error response from daemon: driver failed programming external connectivity on endpoint
<app>-redis-1: Bind for 0.0.0.0:6382 failed: port is already allocated
- When
Running
sail up -don an app that started fine before, after a different kalimera-scaffolded project has been started in the meantime.- Why it happens
NetworkPortChecker::isBusy()picks host ports by opening a socket against127.0.0.1to see what is listening at that moment. A port held by a project whose containers are currently stopped looks completely free, so a later scaffold happily writes the sameAPP_PORT/VITE_PORT/FORWARD_*_PORTvalues into its own.env. Nothing detects the clash until both projects are up at once — then whichever starts second fails. Two apps scaffolded weeks apart can end up with byte-identical port blocks.- Fix
Pick free ports for one of the projects and edit its
.env(APP_PORT,VITE_PORT,FORWARD_REDIS_PORT,FORWARD_DB_PORT), thensail up -d. To see what is actually taken:docker ps --format '{{.Names}}\t{{.Ports}}'Choosing new ports for the app you are not currently running avoids disturbing a live one. This touches only
.env, so it is safe and reversible.
Still stuck? Open an issue with your --log transcript.