Stale data being read from anonymous directory volume for postgres container

Sorry, I have acidentally managed to answer two different questions (different topics) in one answer so I deleted the previous answer to try again

On Windows with WSL2 it uses the 9p protocol so you can access everything from the WSL machine. I don’t remember what happened with Hyper-V. On MacOS I can see two ways. A legacy way can be used by unchecking “use gRPC FUSE for file sharing”. I could not start Docker Desktop without gRPC FUSE so I could not test it.

On Windows:

docker run --rm -it -v /:/data bash

monts the the WSL filesystem into the container

docker run --rm -it -v C:/:/data bash

mounts the “C” drive from the Windows host through WSL.

This is similar on MacOS except it does not have drive letters so my guess is it mounts the folder from the host if that folder exists and you have mounted that folder or one of the parents to the virtual machine (settings / Resources / File sharing).

Acidentally mounting files from from the virtual machine could cause a similar issue but in that case init.sql would not have bee there at all. So strange but I don’t see any volume created when I bind mount something.

1 Like