If you’re like me, you’re probably just getting to the Docker party. Today I ran into what some will consider a noob problem — I wanted to connect to my MySQL container but didn’t know how to go about it.

This mini tutorial isn’t supposed to take you through the entire container setup et al. It is meant to help you connect a MySQL GUI to a Docker container.

From your terminal, run docker ps and you should see a list of active containers

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
fe66288216eb        mysql               "/ mysql"   9 hours ago         Up 9 hours>3306/tcp   sso_mysql
2d98e86de990        redis               "/ redis"   9 hours ago         Up 9 hours>6379/tcp   sso_redis

From my list, you could see that the first container is a MySQL image and this is what we want to connect to. Focus on the column with the PORTS. MySQL is mapped to port 32769, that means that the docker machine’s IP is listening on port 32779 and forwarding it to the “internal” (MySQL docker) port 3306.

Then run docker-machine ip default, it should tell you the IP of the Docker machine. This is the MySQL host you will be connecting to. Mine is That’s it. That simple.


I'll love to hear from you

Do you want to say hello? Email me -

I tweet at @cyberomin

If you enjoyed this post, please consider sharing it.
comments powered by Disqus
Blog Logo

Celestine Omin



Celestine Omin

On Software, life and everything in-between

Back to Overview