Figuring out where my database tables went after database error in an OLS-WP docker server.

What happened:

I run a single OLS+WP docker stack (litespeed+phpmyadmin+mariadb) in a Ubuntu OVS server.

One day, my Wordpress sites report "Error establishing database connection."

Navigating to will show a page with the following message: "We were able to connect to the database server (which means your username and password is okay) but not able to select the wpacezalba database."

Docker restart and docker-compose down + docker-compose up -d does not solve the problem. Sudo reboot does not solve the problem.

The /sites folder still has the files of the Wordpress sites.

Webadmin still has the vhost records for my Wordpress sites.

I can still log into phpmyadmin using the credentials I've made using But the Wordpress tables no longer exist.

I've encountered this twice already. The first time, I just repeated the entire process of setting it up from scratch. I obviously don't want to go through that again unless there is nothing else left to do, especially since my credentials still work.

What I want to happen:

1. Recover my websites in some way.

My initial research has shown me that when a mariadb docker image goes down, the data disappears with it. However, it can be setup in such a way that the database data remains persistent.

Being a docker noob, I don't know if the OLS+WP docker is set up in a way that (1) the WP Tables is written to disk or (2) is kept live in memory only. Does anyone know which is it?

I am hoping that it is (1), because if it is, I might still be able to recover it in some way given that the database credentials still work somehow. More so, before this error, docker restart does not cause a database error or wipe out the Wordpress tables. If it's (1), is recovery still possible? How?

(2) is bad obviously. This would mean that recovery would impossible for now; and that I'd have to do over.

2. Proof my site from this scenario

Can anyone recommend a command-line backup setup for a OLS+WP docker stack, in case my docker server crashes again and my Wordpress database tables disappear once more? Like automating a mirror of the live container daily/weekly, and running a command to load or recover from this mirror. Or a recommended way to do a database dump of the live mariadb container from the command line.

Thanks for any help you can provide.


For mysql docker container, there's a volume set up by default to store data in the disk (/data/db), so docker-compose down, start, restart will not cause the data to disappear.
      - "./data/db:/var/lib/mysql:delegated"