-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for WSL2 docker without Docker Desktop #3534
Comments
I suppose it is possible and easy! I run "native docker" installed as RH CentOS platform packages using yum and CentOS documentation. inside CentOS7 distro. It doesn't contradict Cuda 11. docker-compose is there too. It has other benefits like correctly working docker CLI. |
I assume that you're wanting to use devcontainers (Remote-Container) with WSL and GPU? (If not, apologies and ignore the rest of my comment!) With the disclaimer that I haven't tried this exact scenario (and am not on the VS Code team!), I would have expected this to work without configuring the When I look at the commands executed in the output for devcontainers, they all seem to be running
|
@PavelSosin-320 thank you for sharing, yes I can also confirm vscode-remote and Docker GPU passthrough work fine on linux (I'm running Arch if it matters). However, I am raising this issue specifically for the WSL2 use case. @stuartleeks You've described exactly my use case :) I've tried "Re-open in container" without configuring |
//cc: @chrmarti to confirm |
We might still check with the Windows-side Docker CLI if Docker is running. I need to check and update that to use 'wsl docker' too. |
If Docker daemon running on the remote host it is enough to create corresponding Docker context to access it regardless of its implementation: docker running on a standalone node, Swarm or Kubernetes cluster. |
Please let me know if there is anything I can do to support; I am not able to find the source but I am happy to validate patches. |
I'm fixing the version check to run inside WSL. The Remote Explorer viewlet is still using the local Docker and will show a message that there is no Docker when it can't find one on Windows. That shouldn't affect anything else. Keeping this issue to track that remaining work. |
Fix for the version check is available in Remote-Containers 0.139.1. (Currently requires VS Code Insiders.) |
On Remote-Containers 0.139.1, I can confirm that I can now "Open in Container" to get a devcontainer running on WSL2 Ubuntu Docker. This is an improvement over erroring about Docker Desktop. However, the "Attach Visual Studio Code" option (available under Microsoft's Docker extension tab) seems to NOOP now (previously it threw an error about Docker Desktop not installed). I suspect this feature is related to the Remote Explorer... |
The default is to use the local Docker CLI. You could try opening a WSL folder (either under How do you configure the Docker extension to work with Docker in WSL? |
Precisely as you've described above :) I open Remote-WSL Docker and the
Docker extension defaults to using Docker in WSL. This is how I am reproing
the behavior.
On my Windows host (without Docker Desktop) the Docker extension actually
raises an error and does not list WSL containers.
…On Fri, Sep 4, 2020 at 12:58 AM Christof Marti ***@***.***> wrote:
The default is to use the local Docker CLI. You could try opening a WSL
folder (either under \\wsl$\ or with Remote-WSL) to make it use WSL's
Docker CLI and then use "Attach Visual Studio Code".
How do you configure the Docker extension to work with Docker in WSL?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3534 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHRW5LZ4HJYUFLJD3FPTMDSECM2RANCNFSM4QCYLB2A>
.
|
Using Remote-WSL as the cue on when to use WSL's Docker CLI sounds like a better approach than just looking at the open folder. I'll look into that. 👍 |
Using WSL's Docker when in an empty WSL window depends on https://github.com/microsoft/vscode-remote-release/issues/3638. The Remote-Explorer will need additional work because we want to not only show the DevContainers of the current WSL-distro and for that need to continue to hold a system-wide view. This will come up again with Remote-SSH once we get there. Removing target milestone for now. |
I see; we could possibly just use filepath / folderpath ( |
Published an improved fix with 0.148.0 of the extension (currently requires VS Code Insiders). The Remote Explorer should now also work. (Empty WSL windows still don't work.) |
The second screenshot in your last post shows you're not connected to WSL. Could you try attaching to the container from the Remote Explorer (or the Docker viewlet) while connected to WSL (first screenshot in your last post)? |
You can attach to a container using the context menu on a container entry in the Docker or Remote Explorer viewlets. (Switch to 'Containers' at the top of the Remote Explorer.) You're right, the setting needs an executable. It should work without that. |
The docker CLI fromChocolatery is always ready to server you Windows Docker CLI from Choco |
@chrmarti The Remote-Explorer viewletdoes not detect WSL Docker: whereas the Docker viewlet does: @PavelSosin-320 Thank you for the reference! Do you know how to configure the referenced Windows Docker CLI to use a WSL Docker Engine? |
In the regular way - using docker context create command with docker host = tcp://ip-of-machine running docker, i.e. localhost
|
@feynmanliang Could you check with VS Code 1.51 and Remote-Containers 0.148.0? It works with these versions for me. (I'm testing by renaming the Docker executables on Windows, so they cannot be used.) |
On the server side I created the following daemon.json in the /etc/docker: The main area of issues is IPV4 / IPV6 localhost interpretation in the heterogeneos Home networks - 2 localhosts per device and VM, 127.0.0.1 and [::1] |
@chrmarti I was having the exact same issues described here and can confirm that upgrading Remote-Containers to 0.148.1 fixed it for me. Specifically, the Remote Explorer now shows and allows me to connect to containers in wsl |
@dparker2 Thanks! Can confirm "Attach Shell" from Docker viewlet. Are you able to "Attach Visual Studio Code" (still alert dialog with "Docker returned and error" on Remote-Containers 0.150)? @chrmarti On Remote-Containers 0.150 I can now see the filesystem of a WSL container under the Docker viewlet of a WSL-Remote VSCode as well as open these files: |
So the workaround is this: https://code.visualstudio.com/docs/containers/ssh, first setup ssh in WSL2, and then use that tutorial to connect the docker windows to the WSL2 docker host. |
Both Docker Desktop and my Docker engine run inside VM running inside
Windows OS. The approach "Remote Docker host" is not applicable to this
scenario. TCP Communication between Host and Singleton WSL VM is always
secure. WSL VM has no public IP, i.e. it is not visible outside Host. So
Installation of SSH server inside WSL is meaningless.
In any networking scenario, very slow SSH is the last resort applicable
only to slow WAN without VPN.
In the LAN scenario, the correct selection of Network type in the Windows
setting, the correct configuration of your router, the careful pairing of
network devices provide better security without paying any performance
cost. SSH performance is enough only for slow terminal communication.
In WAN scenario Enterprise Docker-ready server Selinux distros like RHEL
and their firewalls provide military-grade communication security. over TLS
1.3 hardware-implemented encoded connection.
…On Fri, Nov 27, 2020 at 5:37 PM Satyajit Ghana ***@***.***> wrote:
So the workaround is this:
https://code.visualstudio.com/docs/containers/ssh, first setup ssh in
WSL2, and then use that tutorial to connect the docker windows to the WSL2
docker host.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3534 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM7YVKBKUCQSVQXRZ4OQBFDSR7BVLANCNFSM4QCYLB2A>
.
|
@feynmanliang Could you try attaching from the Remote-Explorer viewlet? The Docker viewlet is from the Docker extension and recently added a way to browse the files inside a container (independent of Remote-Containers and not with integration into the DevContainer's tools). The likely cause of Attach Visual Studio Code from the Docker viewlet not working is microsoft/vscode#111238. That action should fall back to showing a list of running containers in a QuickPick at the top of the window, I need to investigate why it instead ends with an error for you. @satyajitghana Connecting to a container running in WSL without having the Docker CLI installed in Windows should work now. The remaining limitations are that you need to use the Remote-Explorer for attaching (microsoft/vscode#111238) and that you need to have a folder open in WSL (microsoft/vscode#111371). |
@chrmarti Thanks ! Yes, Attach to Container Works, but then a slight inconvenience is that i have to create the volume, something the extension does automatically in Docker for Windows. But yeah, GPU is working ! so that's there. |
@satyajitghana Using a devcontainer.json should also work. Do you seen any issue with that? |
yes, that does not work for me open folder -> Remote-WSL: Reopen folder in WSL -> Remote-Containers: Reopen in Container produces:
what is working: i just tried it, the above thing is also giving me an error now:
i think i messed up something for the attach vscode, it was definitely working before. Attach shell is working though ! UPDATE: i tried with vscode insiders with Remote-Container v0.151.0, but same issue as above |
To mount bind volume to docker container the host path should be /mnt/c/.... |
@satyajitghana Make sure you have a WSL folder open when you try to attach to a container. Same when reopening a folder in a container, the log shows The recommended way is to have Docker Desktop for Windows installed, that will also work with Windows folders. This issue is about having Docker installed only in WSL which is the case @feynmanliang is working with. |
@chrmarti yes ! that got it working, simply moving my project to WSL folder, and opening it as container, devcontainer.json is picked up as well ! |
@satyajitghana Instead of moving your project you can point to your workspace from wsl: |
No containers are listed under Remote-Explorer "Containers" (which I'm guessing is trying to find a docker.exe on Windows): In contrast, the Docker extension (which I guess in this Remote-WSL VSCode is falling back on WSL2 Docker) is showing them: |
OK, I am able to get this working following @PavelSosin-320's suggestions to connect a Windows docker client over tcp to a wsl docker engine, specifically:
In addition, I needed to point the We can close this issue. |
Ok, thanks @feynmanliang. |
It seems that Docker Desktop and GPU passthrough are mutually exclusive. Per NVIDIA's WSL CUDA guide:
https://docs.nvidia.com/cuda/wsl-user-guide/index.html
To see if we can have both remote containers and GPU passthrough, I tried setting
"remote.containers.dockerPath": "C:\\windows\\system32\\wsl.exe docker"
but am seeingWould it be possible to have vscode-remote directly use the underlying
docker
instance running within WSL2, without the dependency on Docker Desktop (or at least until Docker Desktop/NVIDIA figure out compatibility i.e. docker/roadmap#96)?The text was updated successfully, but these errors were encountered: