Docker-compose mounted volume inconsistent file contents

Odd issue, some in-container apps are seeing different file contents on a ro mounted volume.
Volume is a windows folder mounted to the containers as read only (via docker-compose volume directive )

after file update in windows, cat, wc, flask, celery and others see a truncated file with old file contents while less, vi, head and tail see the correct file.

truncated file with old contents means after the change, the file size changed but the contents are the same, so deleting three lines of fifty bytes each in the middle will result in cat/wc/flask/python reading the original file minus 150 bytes from the end.

This is happening on two containers simultaneously.

# wc -l myapp/app.py
9
# cat myapp/app.py | wc -l
9
# tail -n 10000 myapp/app.py | wc -l
14
# diff <(cat myapp/app.py) myapp/app.py
# diff <(cat myapp/app.py) <(tail -n 1000 myapp/app.py)
Files /dev/fd/63 and /dev/fd/62 differ

Same issue for me, some files are truncated when using cat and complete when using tail or vi.
Using Windows 10 and Docker Quickstart Terminal (version 17.06.0-ce, build 02c1d87).

Any pointers on how to fix this issue ?

three months with no help, we just stopped using docker, too many of these problems poping up.

Exactly this type of thing is the reason to stick with docker on its native Linux, if that’s an option for you. Docker for Windows has tried hard to be transparently the same as docker on linux but it’s just not yet, particularly in the area of mounted volumes, thanks in part to differences in access control, permissions, ownership.