How to change wordpress table prefix in Docker image?

Dear experts,

We are trying to use Docker official image to deploy WordPress sites. It seems working fine after configuring. However, I found that the default table prefix is wp_ while we need to change it to something else. I’ve been googling around with no luck, even using WordPress plugin which seemed to change it. However after change was made, the image was somehow starting over but asking to install a new WordPress site.

Any idea how we can change the table prefix and get to install our new WordPress by using custom table prefix? Thanks a lot in advance.

P.S. We are using Docker for Windows


Its always an good idea to check the docker hub page for that image:


Dear @terpz,
Thanks a lot for your comment. I’m very new to docker so please bear my further questions.
So we need to modify our wp-config-docker.php file first, then we run the docker image with this additional parameter, am I right?

Hi again.

I think the easiet is to just start over with that parameter in the docker run/compose.

But, if you need to keep the existing installation, then I THINK you just need to:

  1. stop the WP container
  2. make the changes in the database
  3. add the WORDPRESS_TABLE_PREFIX env variable ( i belive it will rewrite the wp-config-docker.php, but you can edit it yourself )
  4. start the WP container again

Dear @terpz,

Thanks again. I might need to spend some time to learn how to perform the step 2 and 3:)
Thanks again!

Yea thats why i said i think its easier just to start over :wink: