I am using [email protected] build 6a30dfc) and [email protected], build 9e633ef.
Given a docker-compose.yml
(that used to work fine for a very long time and was unchanged since April 2019) file that only spins up a mariadb container and is supposed to expose the mysql port to the host:
pe-db:
image: mariadb:10.3
ports:
- 3306:3306
environment:
MYSQL_DATABASE: dev_db
MYSQL_PASSWORD: password
MYSQL_USER: dev
MYSQL_ROOT_PASSWORD: root_password
yet when running:
docker-compose up
I am getting the error message:
Recreating fcac8d931b6a_ratepipeline_pe-db_1 ... error
ERROR: for fcac8d931b6a_ratepipeline_pe-db_1 Cannot start service pe-db: driver failed programming external connectivity on endpoint ratepipeline_pe-db_1 (6e649313e4cccd484d0672183cd24daf21c5e8ad3dc1e01fda57d0c942194b6d): Bind for 0.0.0.0:3306 failed: port is already allocated
ERROR: for pe-db Cannot start service pe-db: driver failed programming external connectivity on endpoint ratepipeline_pe-db_1 (6e649313e4cccd484d0672183cd24daf21c5e8ad3dc1e01fda57d0c942194b6d): Bind for 0.0.0.0:3306 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
When checking what runs on port 3306
via:
sudo netstat -nlp | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 3042/docker-proxy
I see the docker-proxy. There is no other mysql database running locally. I can kill the docker-proxy
via:
sudo killall docker-proxy
sudo netstat -nlp | grep 3306
and then I see nothing running on port 3306
. Yet docker-compose up
will run into the same error again, claiming port is already in use even though netstat
will show no user on the port.
I also tried restarting the docker daemon via
sudo service docker restart
and rebooting my system. The issue persists.
How can I fix this issue?
In my case, I did in fact have a mysql container running. It would not show on netstat, but I could see it via
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b59b7973d88b mysql:5.7 "docker-entrypoint.s…" 10 days ago Up 8 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp squbsstub_db_1
I then could kill that container via its CONTAINER ID
, in this case:
docker kill b59b7973d88b
Then my former docker-compose project would spin up fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With