i’m a newbie at this and im trying to set laravel sail to my laptop using ubuntu terminal. there’s no problem in installation but when i use the command sudo ./vendor/bin/sail up
i get this error:
Error response from daemon: driver failed programming external connectivity on endpoint exapp-mysql-1 (8b37fca8d11d52f0456d65180990c572d9d7b39a54944845ee6ba7f1634a2d59): Bind for 0.0.0.0:3306 failed: port is already allocated
i know i need to change the port that it selects and tried to find ways in many blogs but couldnt seem to find a solution that solves my problem yet.
i tried to get rid of zombie process’, tried to stop container and deleting it, i tried restarting docker but they didn’t solve my problem. i’d appreciate any idea and help i could get.
2
Answers
If you are using docker-compose.yml you can use "ports" under the service that you want to configure, like:
Just change the port "3307" for some port that is available on your laptop and change if necessary the port "3306" to match port(s) that your container is using.
The line – "3307:3306" under ports tells Docker to bind the port 3306 of the nginx:alpine service (inside the Docker container) to the port 3307 of the host machine. This means that the nginx:alpine service will be accessible at localhost:8080 on your host machine.
This is a multi step fix
docker ps
and see what containers are running.docker stop {name}
./vendor/bin/sail up
to restart the serviceIf you find it still giving you a bind error it’s likely your running MySQL/MariaDB or equivalent on your local system in which case you will need to stop those services before restarting