I am trying to setup an existing wordpress site in docker in my local system, I have all the site content copied to a folder in my local system and using 'Volumes' in docker compose file to tell docker which folder to use as the content but when i try to run docker compose and initialize containers website starts but it setups default wordpress template instead of using the existing content present in the local system.

Also i dont want to use any plugins to migrate content from the existing site as the content size is very huge, Could someone guide me through the best approach to clone the site.

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.