ERROR: for dockervel_mysql_1 Cannot restart container c258b418c03cbd6ec02c349c12cf09403f0eaf42fa9248019af7860d037d6474: driver failed programming external connectivity on endpoint dockervel_mysql_1 (da3dd576458aa1fe3af7b539c48b9d61d97432cf5e9ee02d78562851f53981ae): Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use.
I have to make LAravel app and to deliver a Dockerfile ,but i'm realy stuck with this. Before that I had a nightmare wile installing laravel on my machine.
I'm trying to get dockervel image and I'm following the steps here:
http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
But when I run dartisan make:auth it gives this error above.
I have tried to Change the default port in the docker-compose.yml
ports:
- "8084:80"
still nothing,also tried to stop apache2 (service apache2 stop) on my machine ,also tried docker-compose restart and removing docker container dockervel_mysql_1.
I have to mantion that I have alredy one Laravel proj. in /var/www/laravel .
Please help!
Probably you have already a MySQL service running in port 3306. You should close it first.
Then try to end docker-compose down
and restart it with docker-compose up
.
Remember also to change the permissions after you add a file in your project (like dartisan make:auth
) with dpermit
UPDATE:
since you have changed the port to "8084" you should go to localhost:8084
If you see the apache default then you probably are browsing another server since dockervel is build upon nginx
.
You have also probably have some gaps on Docker. Don't mix your local storage with docker storage. /var/www
in a container is different than your local /var/www
. in docker-compose.yml you mount the local ~/dockervel/www
to containers /var/www
.
I would suggest that you start all over again and revert the changes you've made to your apache server. Shut it down, you don't need it. Dockervel will provide you with an NginX server in a container.
I had the same problem and
sudo netstat -nlpt |grep 3306
showed me the PID and which service it was started by (mysgld). Whenever I tried to kill the PID then it was started again. But the problem was fixed when I stopped the service by
sudo service mysql stop
Notice that you will have to use mysql
and not mysqld
.
I hope that this will do it for you - I was able to run docker-compose up
without any problems
on Ubuntu running this command will stop your mysql from running for your docker container to work.
sudo service mysqld stop
Then, if your apache2 is running, you need to stop the service especially when you want to work with nginx.
sudo service apache2 stop
Then, you can run your docker-compose up -d ...
command
The error you are seeing is from a local mysql instance listening on port 3306 (currently on pid 1370 from your comments). You won't be able to run a container that publishes on this host port while it's already in use by another process. Solutions are to either stop mysql on the local host, or to change/remove the published port in your container. If the port is only needed by other containers, you can leave it unpublished and they can communicate directly on the docker private network (by default, this is "bridge").
You need to change the mysql port
because you are installing mysql on your machine and it takes the default port 3306
and now you are trying to make dockervel_mysql_1 run to the same port 3306 , this is why you see in the error "Address already in use"
so if you change dockervel_mysql_1 port to 3307 for example it will works fine , without stopping the mysql that is running on you machine