0

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?

1 Answer 1

0

You can publish your MariaDB port by running:

docker run -p3306:3306 mariadb

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 container mysql client for importing that data. For example:

docker exec -i mariadb_container mysql -uroot -pmypassword mydb < /path/inside/host/data.sql
1
  • I actually solved this by running phpMyAdmin in a linked container and using that to import the data. Thanks for the suggestions though, I will bookmark them for the future.
    – Tim Long
    Jun 3, 2020 at 14:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .