Docker Community Forums

Share and learn in the Docker community.

Database empty after update

Hi all!

First time poster here. I have been using Docker Desktop for Windows for a half year approrximately now and it has been working well. I use chocolatey and ddev with it to run php-sites.

Yesterday I updated Windows 10 to latest version (2004) and I also updated Docker Desktop for Windows. It seems Hyper-V got a new version as well in the Windows Update.

After all this, my ddev project site is still running, but the database has no tables.

I fear they are lost due to updates. I also switched to WSL 2 momentarily and then switched back to WSL 1.

I used Windows System Restore to get back old configuration, but it did not help. It only broke the Windows menu! It’s not working anymore. :sweat_smile:

I have a couple of questions: where are the database data stored in Windows, when using Docker + ddev?

Is there a discussion forum for ddev-related matters? Googling with word “ddev” is a pain. I cannot really find anything but the same ddev help page I always read.

Is there a reason for database stuff to disappear due to program updates? My knowledge of containers is very limited. I have no idea where the data is actually located on my computer. I could try to restore the data if I could find the files.

Thanks in advance!

Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:43:18 2020
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:27 2020
OS/Arch: linux/amd64
Experimental: false
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
Version: 0.18.0
GitCommit: fec3683

Docker containers are stateless so all data is wiped when they’re stopped. If your DBs data directory was mounted to a host (Windows) folder, it’d still be there. But, if you used a Docker volume, the switch to WSL2 could have wiped it. WSL2 changes how and where Docker containers run - none of the data would be available.

The key takeaway: back-up your databases!

I know it’s a little late now, but data is fragile whether you’re using Docker or not. Ideally, you should automate that (perhaps a cron job to run mysqldump).

Docker ps -a ( shows all containers you have created, find the last one you remember working)
Docker inspect (ID of container you were using)
Docker volumes ls
Match the docker volume to the one from the inspect…
Docker volumes inspect (volume id)
This should tell you where in the file system that container used to store persistent data.

Also would be helpful to see the docker command or compose file you use for the containers.