Container/Host file permissions

I have a problem with file permissions/visibility I can’t figure out. Please help.

I start a container with -v "$PWD":/data -w /data to mount current directory; --user $(id -u):$(id -g) is to get host user. Container can create files that are properly visible on host, but not in container.

Ensure folder is empty:

testdir$ ls -l
total 0
testdir$ docker run --name hardprog-container --rm --user $(id -u):$(id -g) -v "$PWD":/data -w /data hhucn/hardprog ls -l
total 0

Create a file from host (it is not visible from container):

testdir$ echo . > hostfile
testdir$ ls -l
total 0
-rwxrwxrwx 1 tymur tymur 2 Jul  7 12:20 hostfile
testdir$ docker run --name hardprog-container --rm --user $(id -u):$(id -g) -v "$PWD":/data -w /data hhucn/hardprog ls -l
total 0

Create a file from container (it is visible from host, but still not visible from container):

testdir$ docker run --name hardprog-container --rm --user $(id -u):$(id -g) -v "$PWD":/data -w /data hhucn/hardprog echo . > containerfile
testdir$ ls -l
total 0
-rwxrwxrwx 1 tymur tymur 2 Jul  7 12:20 containerfile
-rwxrwxrwx 1 tymur tymur 2 Jul  7 12:20 hostfile
testdir$ docker run --name hardprog-container --rm --user $(id -u):$(id -g) -v "$PWD":/data -w /data hhucn/hardprog ls -l
total 0
testdir$

There is an additional quirk to my setup: docker is running on Windows, and the shell commands above are executed via “Ubuntu on Windows” (with DOCKER_HOST=tcp://localhost:2375).