How to connect remote docker container mysql server

Please review the below stack exchange question

I am installing magento web application, now I have a
situation like I need to use/point the existing docker container
database.I have make port forwarding in order to access database from
remote machine but it throws error like http://i.stack.imgur.com/5ycpE.png.

This is my run command for creating docker database container

docker run -it -d -p 3002:80 -h tm.gworks.mobi -v /var/www/public --privileged --name database magedev

I am waiting for your quick response thanks!

That looks odd in several ways to me, most significantly that the only port you’re exposing is an HTTP service (port 80), not a MySQL service (port 3306). I’d expect this command to look more like

docker run -d -p 3306:3306 mysql

(You shouldn’t usually need to run containers --privileged or explicitly set their hostname.)

1 Like

yup you right thanks alot, just now I found.