Docker context cannot see

I use latest Docker and WSL on my local Windows machine. Latest Docker on my remote Ubuntu machine.
I want to create a Docker container in my remote machine using Docker context.
From my local machine:
docker context use default
docker run -it --volume //c/Users/myname:/project -w /project ubuntu

i see all my home files as expected.
Then to connect to my remote machine containers:
docker context use my-remote-engine
docker run -it --volume //c/Users/myname:/project -w /project ubuntu

And here is the issue. I see only a few of the folders in my home folder and no files at all. If i create a files from the container and exit the container, the file is not in my home folder.
Is this expected?

You can’t mount a local fodler to a remote machine. When you are using a remote machine, you need to copy the files to that machine before using the docker command or copy everything in the build step. Copying files to a remote server during the build is supported, but mounting files are cannot be supported. It works with Docker Desktop only because it is special and Docker Desktop can handle the mount to its own vitual machine so Docker CE inside the VM can mount it to the container…

Thanks for answering.

I don’t understand this sentence. So, my Windows Docker Desktop can successfully mount a Container’s folder (or at least syncronize to it, after initial copying of files from local to remote container)?

The point is that you can’t mount a local file/folder to a remote machine over network.

1 Like