microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
173 stars 26 forks source link

Specifying Host Machine in Visual Studio doesn't seem to work #363

Closed Andomeda83 closed 1 year ago

Andomeda83 commented 1 year ago

I'm not using Docker Desktop, instead I have the docker cli installed on my Windows host as well as on a Ubuntu WSL instance.

From a windows command line, I can specify the WSL host and it works as expected:

> docker images
REPOSITORY                                                 TAG       IMAGE ID       CREATED        SIZE
mcr.microsoft.com/cosmosdb/windows/azure-cosmos-emulator   latest    b95ffb8c77b6   9 months ago   13.1GB

> docker -H localhost:2375 images
REPOSITORY                                                        TAG                    IMAGE ID       CREATED        SIZE
mcr.microsoft.com/dotnet/sdk                                      7.0                    8cd497c32e47   8 days ago     761MB

Within Visual Studio I have set the Container Tools "Host machine used to run containers" setting to WSL:

image

But I still get errors when trying to build Linux projects (<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>):

image

Finally, the containers window is showing the images I have within Windows

image

Is there another setting I'm missing? Or are my expectations incorrect and this scenario isn't possible?

NCarlsonMSFT commented 1 year ago

@Andomeda83 The UI on the right for your second screenshot appears to be from the C++ CMake tools not the container tools for .NET.

As tracked in https://github.com/microsoft/DockerTools/issues/313 currently only Docker Desktop is supported by the VS container tooling. However, I believe you could use the remote WSL feature of VS Code to be able to do what you are hoping for.

Andomeda83 commented 1 year ago

Thank you for the update @NCarlsonMSFT.

I'm not seeing any reference to C++ CMake in that part of the options. I don't seem to have any C++ tooling selected in "Visual Studio Installer", so how would I confirm this please?

Either way, strangely, if I select that option today, it's different. That dialog does seem to lag so perhaps it didn't refresh. It now shows:

image

The right hand side of the screenshot above is actually from Cross Platform->Dev Containers, but thank you for pointing out #313. At least I now know it's not supported.

Finally, you're right that it works in VSCode. I have this set:

image

Happy to close this issue.