Docker Community Forums

Share and learn in the Docker community.

Failed to start MYSQL container


(Krishnakrshukla) #1

I have below code in my docker-compose.yml file


services:
databases:
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=demodb
image: mysql
ports:
- “3306:3306”
web:
image: nginx
version: “2”

******but when I am executing the above script getting below error:

root@test01:/usr/local/bin# ./docker-compose up
Starting bin_databases_1 … error
Starting bin_web_1 …

ERROR: for bin_databases_1 Cannot start service databases: b’driver failed programming external connectivity on endpoint bin_databases_1 (473d63daf79823d5ed2c153513c3b358bf758cdb4d07de4028c65c54c217a8ea): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already Starting bin_web_1 … done

ERROR: for databases Cannot start service databases: b’driver failed programming external connectivity on endpoint bin_databases_1 (473d63daf79823d5ed2c153513c3b358bf758cdb4d07de4028c65c54c217a8ea): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use’
ERROR: Encountered errors while bringing up the project.

but my container is created :
root@test01:/usr/local/bin# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee40a0f2a0a1 mysql “docker-entrypoint.sh” 37 hours ago Created bin_databases_1
a1871cde66bc nginx “nginx -g 'daemon off” 37 hours ago Up 39 minutes 80/tcp bin_web_1

when i tried to start my MYSQL container getting below error:

root@test01:/usr/local/bin# docker restart ee40a0f2a0a1
Error response from daemon: Cannot restart container ee40a0f2a0a1: driver failed programming external connectivity on endpoint bin_databases_1 (6376e1848044b030dd21f0b757dab0466f750938363b6ae916f61d1149ff0862): Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use

Thanks in Advance…


(David Maze) #2

You told Docker to listen on host port 3306 (the left-hand side of the Docker -p option or the Docker Compose ports: directive), but something else is already using it. That could be another Docker container with identical configuration, or a MySQL database running on the host, or something else.