Reputation: 163
I am trying to create a container with docker-compose
so I ran docker-compose up
on the following compose file:
services:
mysql:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: admin
MYSQL_PASSWORD: joesam007#
MYSQL_DATABASE: Woodcore-test
After pulling and building the image, while trying to create the db, the error response shows thus:
Creating microservice-task_mysql_1 ...
Creating microservice-task_mysql_1 ... error
ERROR: for microservice-task_mysql_1 Cannot start service mysql: driver failed programming external connectivity on endpoint microservice-task_mysql_1 (3f2a9ad024c6e586a9c7f089a388cecf7decbf7870106b5b34e5a21e88b415a3): Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use
I'd like to know how to handle this issue and create the db successfully. Please help, thanks.
Upvotes: 0
Views: 885
Reputation: 642
Sounds like you are running an existing MySQL Database on your host port 3306. You can confirm via the following command:
Windows: netstat -a | findstr :3306
Linux: netstat -a | grep :3306
If you don't want to stop that Database/Service consuming that port, you can always change the host port which it binds to by updating your docker-compose config file to:
- "3307:3306"
This will then let you connect to the containers database on port 3307 from the host machine.
Upvotes: 1