Sqlite db locked when on a windows volume

Whenever I run an image that uses a sqlite database, if I put that database on a volume shared by windows I get a database is locked error.


Host is Windows 10.

 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Wed Apr 27 00:34:20 2016
 OS/Arch:      windows/amd64

 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   8b63c77
 Built:        Mon May 23 20:50:37 2016
 OS/Arch:      linux/amd64

Steps to reproduce the behavior

  1. Set up a shared folder in windows for the volume to be mapped to.
  2. docker run --name=ghost -v /path/to/shared/folder:/var/lib/ghost ghost
1 Like

I hit this bug today.

Database file is reported as locked, because CIFS requested a lock.
Volumes from Windows drives are mounted using CIFS on the linux side. If you try to use a database file over the SMB (running Linux, using share on Windows) without Docker it will behave the same.

I’ve found a workaround (solution?):
You need to edit Docker’s PowerShell script that starts the Docker VM.
It can be found here: C:\Program Files\Docker\Docker\resources\MobyLinux.ps1
You need to change the mounting parameters in the “Mount-Volume” function.
“noperm,iocharset=utf8” to “noperm,iocharset=utf8,nobrl”, in both lines (258, 261).

After a restart of Docker for Windows everything works as expected.

Hope it helps


The latest beta seems to remove the mounting options from the MobyLinux script, so I’m back to square one with this issue :weary:

1 Like

Specifically in the new Docker for Windows there is no way to define the mounting parameters… So we’re going backwards on this issue.

I opened an issue this weekend, hoping on a comment soon.

I’ve been digging around but found no other way to manually set the mounting params so at the moment i’m completely stuck.
I’ve several images that make use of sqlite where I would like to keep the db file accessible (non for concurrent use, just for backup/safety) and all of them are unusable.

Great. Hopefully there will be a fix.

The only, semi-coherent, workaround I can think of for now is to copy the database from the mount to a local docker folder on ENTRYPOINT and then sync it back using inotifywait wrapper, like this: https://github.com/hollow/inosync