Problem related to accessing Mysql Database in Docker container environment

Hi everyone,
I have to say that i’m totally new to Docker so there’s lot of things i don’t understand. I hope someone could help me clarify it, i really appreciate.

I followed this tutorial on the Internet and sucessfully installed Wordpress on MyIP address:8080

The point is i don’t know which Mysql database that WP’s using? When i was running the container and trying to check with the command “mysql_secure_installation” or trying to log in to Mysql i always get this error.

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock’
So how should i do now?

Can someone help me?

Hi there. This images uses supervisor to have mysql and wordpress running at the same time. When you use the given run command, you only make the port 80 for http available for public access.
sudo docker run -p 80:80 --name docker-wordpress-nginx -d eugeneware/docker-wordpress-nginx
I took a quick look and could not find any configuration on the port in the dockerfile, so I guess it uses the default port. This means you can try the following command
sudo docker run -p 80:80 -p 3306:3306 --name docker-wordpress-nginx -d eugeneware/docker-wordpress-nginx
After that you should be able to access the mysql database through localhost:3306. But you might not want to run this command on a public server.

Thank you so much for a comment. So i did create my own Docker images using Dockerfile and tested if i could log in to Mysql in Docker container environment but it didn’t work. (of course i know which database the WP’s using because i created it with some scripts in Dockerfile). I guess we don’t have any method to do this,