Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alex32's avatar
Level 2

Laravel 12 in Docker | ports are not available (3306)

I've installed laravel 12 in WSL with no errors. When I try to build the Docker containers from Sail I get the error below about a port conflict 3306 used by MySql. I've seen few posts below, and tried to change that port in .env and docker-compose.yml but nothing worked. In Docker Desktop for Win 10 , I used to get the same error then I restart the project and Sail worked. But in Win 11 that option is greyed-out and even restarting Docker doesn't help. Thanks

  • Docker Desktop 4.38
  • Laravel 12
  • Windows 11, WSL

With Docker Desktop running:

$ sudo ./vendor/bin/sail up -d   

[+] Running 1/2
 ✔ Container lwalk-laravel.test-1  Recreated                                                                    0.4s
 ⠹ Container lwalk-mysql-1         Starting                                                                     0.4s
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 127.0.0.1:0: listen tcp 0.0.0.0:3306: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

.env | laravel default

docker-compose.yml | laravel default

https://stackoverflow.com/questions/65467799/laravel-sail-is-not-working-properly-in-ubuntu-20-04-lts

https://stackoverflow.com/questions/67053449/unable-to-set-the-app-port-on-env-for-laravel-sail

0 likes
1 reply
alex32's avatar
alex32
OP
Best Answer
Level 2

I resolved the issue by :

  • Removing Node in Windows
  • Changing permissions to the app-folder recursively in WSL: $ chmod -R 777 .
  • Restarting Docker

Please or to participate in this conversation.