I'm trying to get a Linux container to share files with the Windows host, primarily because I want to build some Linux libs, and put the resulting output where I can see them in the file system. I open a cmd.exe window and do the following.
Microsoft Windows [Version 10.0.16299.1565]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\alanmur>mkdir \dev\test
C:\Users\alanmur>cd \dev\test
C:\dev\test>echo for the container >> testfile.out
C:\dev\test>dir
Volume in drive C has no label.
Volume Serial Number is 0C3F-DCE2
Directory of C:\dev\test
2020-01-07 21:45 <DIR> .
2020-01-07 21:45 <DIR> ..
2020-01-07 21:45 20 testfile.out
1 File(s) 20 bytes
2 Dir(s) 52,950,069,248 bytes free
C:\dev\test>docker run -it --rm -v C:/dev/test:/app/data:rw alpine /bin/sh
/ # cd /app/data
/app/data # ls
/app/data # echo for the host >> testfile2.out
/app/data # ls
testfile2.out
/app/data # exit
C:\dev\test>dir
Volume in drive C has no label.
Volume Serial Number is 0C3F-DCE2
Directory of C:\dev\test
2020-01-07 21:45 <DIR> .
2020-01-07 21:45 <DIR> ..
2020-01-07 21:45 20 testfile.out
1 File(s) 20 bytes
2 Dir(s) 52,942,929,920 bytes free
C:\dev\test>
How would I set this up so that the first ls on the container shows testfile.out and then when I exit the container I can see testfile2.out in the host C:\dev\test directory? I swear I had this working before, but I can't figure out what I'm doing wrong now, as I am doing everything the same.