title: mysql docker container get remote host: Connection refused after container running
body: <p>I tried to run multiple mysql docker container on one host server. After setting one first mysql container, it works fine. I following the same step to setting up second one and change the running port from 3306 to 3307 and use different path of dump.sql. After container starting up, I cannot telnet the container with container ip with port but i am able to ping the ip. It shows Connection refused.Trying to add the line bind-address=0.0.0.0 into /etc/my.cnf and restart container and the issue is still the same. I can see second mysql container start and I am able to execute some command on the container but after about 1 mins, the container stop automatically</p>
  
  <pre><code>usr@ip-172-0-1-199:~/$ docker run --name=test-db -p 3310:3306 -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_USER=user -e MYSQL_DATABASE=db -e MYSQL_PASSWORD=pass -v dump.sql:/var/lib/mysql -d mysql/mysql-server:5.7
  0e3fbcbd9126a726584549a13248eb07eb7d97fbeba4795fb5a924037a66b205
  usr@ip-172-0-1-199:~/$ docker ps
  CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                               NAMES
  0e3fbcbd9126        mysql/mysql-server:5.7   "/entrypoint.sh mysql"   29 seconds ago      Up 28 seconds       33060/tcp, 0.0.0.0:3310-&gt;3306/tcp   test-db
  usr@ip-172-0-1-199:~/$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' test-db
  172.17.0.4
  usr@ip-172-0-1-199:~/$ telnet 172.17.0.4 3310
  Trying 172.17.0.4...
  telnet: Unable to connect to remote host: Connection refused
  usr@ip-172-0-1-199:~/$ ping 172.17.0.4
  PING 172.17.0.4 (172.17.0.4) 56(84) bytes of data.
  64 bytes from 172.17.0.4: icmp_seq=1 ttl=64 time=0.037 ms
  ^C
  --- 172.17.0.4 ping statistics ---
  3 packets transmitted, 3 received, 0% packet loss, time 1999ms
  rtt min/avg/max/mdev = 0.037/0.042/0.053/0.009 ms
  usr@ip-172-0-1-199:~/$ docker ps
  CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS              PORTS                               NAMES
  0e3fbcbd9126        mysql/mysql-server:5.7   "/entrypoint.sh mysql"   About a minute ago   Up About a minute   33060/tcp, 0.0.0.0:3310-&gt;3306/tcp   test-db
  usr@ip-172-0-1-199:~/$ docker ps -a
  CONTAINER ID        IMAGE                    COMMAND                  CREATED              STATUS                      PORTS                               NAMES
  0e3fbcbd9126        mysql/mysql-server:5.7   "/entrypoint.sh mysql"   About a minute ago   Up About a minute           33060/tcp, 0.0.0.0:3310-&gt;3306/tcp   test-db
  usr@ip-172-0-1-199:~/$ docker exec test-db "exec mysql -h 172.17.0.4 -u user -p"
  Error response from daemon: Container 0e3fbcbd9126a726584549a13248eb07eb7d97fbeba4795fb5a924037a66b205 is not running
  usr@ip-172-0-1-199:~/$ docker ps
  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
  usr@ip-172-0-1-199:~/$ docker ps -a
  CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                      PORTS                               NAMES
  0e3fbcbd9126        mysql/mysql-server:5.7   "/entrypoint.sh mysql"   2 minutes ago       Exited (1) 37 seconds ago                                       test-db
  </code></pre>