I am trying to get MySQL running in a container. Once it is running, I can not connect to MySql. Connections are refused.
docker build -t yktoo-db-image -f “dockerfile” “MYPATH”
I then start docker by:
docker run -d -e MYSQL_ROOT_PASSWORD=root --name yktoo-db yktoo-db-image
Docker is running, but all connections to database is refused (i connect to host yktoo-db, not to localhost)
What I found:
- Port 3306 on yktoo-db is closed and this is, I believe, root of the problem. Verified by using nmap from host.
- I connected terminal to the container and verified ‘mysqld’ is running. I also tried to use local mysql commands to make sure it is actually operational.
I did try to add “EXPOSE 3306” into dockerfile, rebuild and have same result.