SQLite Forum

Mac M1/Docker/QEMU corrupts database
Login

Mac M1/Docker/QEMU corrupts database

(1.1) By example-user on 2021-09-28 01:25:41 edited from 1.0 [source]

Hello,

My computer is a Mac M1, I have Docker Desktop installed.

I am running a container, sharing a directory from my host to the guest:

docker run --platform -v /m1-host-dir:/vol linux/amd64 ubuntu

When Docker for M1 runs based amd64 containers, I think it uses QEMU to emulate a amd64 CPU on the arm based M1.

This is slow but seems to work for code.

But the issue I have is that there is SQLite code running inside the container, writing to a DB file that should be persisted to the host disk (I assume via some sort of feature to share directories host->QEMU).

I am getting strange results; the process continues as if it can write to the database, but both inside of and outside of the container sqlite3 seems to show a frozen version of the file (not showing the most recent writes). I also get a range of errors.

Is there any way this could work?

I assume it does not work because the way SQLite does locking/wal writes is by using the same OS, and docker for Mac M1 is probably emulating complete second OS with a Linux kernel.

Edit: This seems to be the set up https://news.ycombinator.com/item?id=25454121