I’m using the docker-toolbox for Windows 7. What I want to do is setup a container with MySQL and load the mysql dump that I have. To do this, I decided to use the docker composer. Here is the content of my Dockerfile and docker-compose.yml
Dockerfile
FROM mysql:5.5.55
RUN apt-get update
RUN mkdir /dumps
WORKDIR /dumps
ADD my_dump.sql /dumps/my_dump.sql
RUN mysql -u root -h 0.0.0.0 -e "create database legacy_datasite"
ADD . /dumps
docker-compose.yml
version: '3'
services:
db:
build: .
volumes:
- ~/data-site-mysql/db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: your_password
MYSQL_DATABASE: legacy_datasite
ports:
- 3306:3306
However, when I created the container using the command
docker-compose run --service-ports db mysql -h 0.0.0.0 -u root -p
It returns the following error:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘0.0.0.0’ (111)
I tried other host like 127.0.0.1, 192.168.99.100 (docker machine IP), 127.0.0.1, and even db (service name) because of this suggestion.
Unfortunately, none of them worked. Any suggestions on how to fix this? Thank you very much.