Skip to content
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

WSL_INTEROP access in .devcontainers from WSL #10501

Open
jgueytat opened this issue Nov 24, 2024 · 2 comments
Open

WSL_INTEROP access in .devcontainers from WSL #10501

jgueytat opened this issue Nov 24, 2024 · 2 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality

Comments

@jgueytat
Copy link

@chrmarti Could you reopen the issue?

Hi, in my use case, I open WSL through VSCode Remote WSL, and then, I go into my container through VSCode Remote Container.
The WSL_INTEROP does not change here, I just want to pick the variable from the WSL environment I already have and which is launching docker.

Best Regards,

Originally posted by @meskill in #8026

@jgueytat
Copy link
Author

jgueytat commented Nov 24, 2024

Here are the options that make it work :

    "runArgs": [
        "--privileged"
    ],
    "mounts": [
        "type=bind,source=/mnt/c,target=/mnt/c",
        "type=bind,source=/run/WSL,target=/run/WSL",
        "type=bind,source=/init,target=/init,readonly"
    ],

And there is also another trick about the path :

#!/usr/bin/env sh

[ -f "$1" ] || exit 0

cd "$(dirname $1)"
./$(basename $1)

Launching an application will only work if you are inside the folder somehow.

/mnt/c/Windows/system32/notepad.exe => ko
cd /mnt/c/Windows/system32/ && ./notepad.exe => ok

With this script, I have to run : ./cmd.sh /mnt/c/Windows/system32/notepad.exe

A nicer wrapper could be written. I just picked the simplest to show the trouble here.

List of stuff to check :

  • mounting /mnt/c
  • check the variable WSL_INTEROP (just set the same value than the one in WSL inside the container)
  • access to init (don't know if it's normal)
  • run with privileged mode
  • fix the path trouble

Hope it's going to be smoother.

@vs-code-engineering vs-code-engineering bot added the containers Issue in vscode-remote containers label Nov 24, 2024
@chrmarti chrmarti added the feature-request Request for new features or functionality label Nov 25, 2024
@vs-code-engineering vs-code-engineering bot added this to the Backlog Candidates milestone Nov 25, 2024
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants