Cannot connect to MySQL server inside Docker
<p>First I run mysql image:</p>

<pre><code>docker run -e MYSQL_ROOT_PASSWORD=password  -d  -p 127.0.0.1:3308:3306 mysql
</code></pre>

<p>Then I use container bash:</p>

<pre><code>docker exec -it my_container_name bash
</code></pre>

<p>In Bash I can successfully connect to MySQL server via command:</p>

<pre><code>mysql -uroot -ppassword
</code></pre>

<p>But when I try to connect to MySQL container from Windows cmd:</p>

<pre><code>mysql -uroot -ppassword -h127.0.0.1 -P3308

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (10061)
</code></pre>

<p>If I connect to <code>192.168.99.100</code> instead (this ip is returned by <code>docker-machine ip</code>), then the result is the same.</p>

<p>The question is: How do I correctly expose my MySQL port inside Docker to outside Windows?</p>