Setup existing WordPress site for local development and testing using docker

Do you use wp-env/@wordpress/env? I highly suggest you use it.

Your WordPress inside your docker container can not just magically import the mySQL database for you.

If you have mapped the folder correctly you should be seeing the plugins and themes you have in there but not the data.

You should install WP-CLI locally to export your database from your existing local site.

wp db export will export your database to a file that is displayed.

WP-CLI is also already installed inside the docker container if you use wp-env. So you can run commands through npm. The command should be something like this:

With npm run wp 'db import local.sql'

I never done this and you should read the docs on it. Especially the weird arguments quirks, that is why the quotes are this way.

I pulled this command from someones package.json on Github. They have npm scripts setup for database import and export for wp-cli. This this is probably a perfect starting point for you.