Scenario possible? Use Windows image remotely from Mac/Linux

Hello,

Some background: I develop source code on my Mac that has to be compiled natively for various target systems (Mac, Linux, Win)

  1. I managed to use a docker image with Linux/gcc in VSCode und compile on my Mac for Linux
  2. I managed to built a docker image on Windows 10 which has the Visual Studio C++ compiler tools installed. I can run it locally on Windows and compile my sources using CL.exe

Now I wonder whether I can access this 2nd image remotely from my Mac so that I can compile native Windows binaries. I think I have to remotely “mount” it somehow.

Unfortunately I could not figure out how to do this. Is this possible at all? How?

Thanks,
Peter

I am not sure if I understood you correct, though I will still try.

Windows Containers only run on Windows. You could leverage docker context to communicate with a remote docker engine. You should be able to build images using the context.

If it’s about using something like devspace or vscode remote environment, which uses IDE for local rendering, but has it’s working scope inside a remotely accessible container, it should work.

Hello,

How would a simple context look like considering that I work on a Linux machine and want to remotely use a container running on Windows a Windows load.

Peter

I don’t know how to add the context for Docker on Windows, as I never used it.

For Linux, the easiest way is to piggyback the commands through ssh, like shown in this blog post: How to deploy on remote Docker hosts with docker-compose | Docker

If the Windows Server has ssh installed, you could try if the same syntax works for Docker for Windows. If not, you can always a tcp binding for the docker socket and use certificate based authentication, but it is more complicated to setup https://docs.docker.com/engine/security/protect-access/.

Note: do not create a tcp binding without certificated based authentication, as it would allow everyone to send commands to the docker engine without any authentication.

Hello, I use this command line on my Mac.

docker -H tcp@192.168.6.110 run -it -m 2G --rm -v /tmp:c\:tmp buildtools

That way I want to use my local /tmp content under c:\tmp in the Windows container.

On Windows my config file is:
{
“experimental”: true,
“hosts”: [“tcp://0.0.0.0:2375”]
}

As it is now I get:
docker: Error response from daemon: invalid volume specification: ‘/tmp:c:tmp’.
See ‘docker run --help’.

What could be wrong with my volume spec? Inside the docker container I definitively have c:\tmp.

Any idea?

Thanks,
Peter