I'm setting up a server to host a wordpress site and I have wordpress + mariadb + nginx all running in Docker very well. I can create and configure a new site in WordPress and its all successful.
I'd like to import some pre-existing site data into the Mariadb instance, and because its in a Docker container, it is effectively isolated from any data manipulation utilities. Obviously that's great for security, but what's the best way of making something in docker "visible" to localhost (or even externally) so I can connect up the mysql client?
Best Answer
You can publish your MariaDB port by running:
This way you can access to mariadb instance by connecting to
dockerhost:3306
.Anyway if you only have to import sql data files, I suggest you to use docker
exec
utility and using the containermysql
client for importing that data. For example: