-
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
Display forwarding from docker container #550
Comments
For which application do you want to forward the display? How do you start it? |
I'm running a mujoco simulation inside a docker container, and in some cases would like to visualize the simulation. I'm using the official c++ api which uses glfw to create the window. |
This seems to be an issue independent of VS Code's Remote Containers. Do you have this working just with Docker? |
Yes. I used this script which worked fine:
When I move all these arguments into |
Hi. Code user here in a similar situation. I followed up with @ilinojkovic via email and we reached the conclusion that X11 forwarding works with the following
Some of the lines in his original setup were messing things up. As extra info, I am logging as a Regardless of this having worked, I think it would be positive to add some documentation on how to achieve this and/or ease the workflow. For image/video applications (think OpenCV, VTK, PCL, Kinect, ROS, etc, which are all dependency hell) or even basic Data Science environments (interactive matplotlib plots, for instance - I know the Jupyter cell mode exists in VS Code, but interactivity there is essential), having access to the native windows is critical. I image that as VS Code Remote gets more popular and some of these complex frameworks start to consider offering its development environments through containers, this request will become increasingly popular. Also taking the opportunity to thank you for an incredible piece of software. It's stellar! 👍 👍 |
Great, thanks @ishouldbedany @ilinojkovic ! @Chuxel Is X11 forwarding something you would want to include in our documentation? (See above comment.) |
Just as a follow up, the issue was solved with the modification from @ishouldbedany's comment, but then reappeared. In the meantime, I updated os packages and vs-code itself, so I don't know if that's somehow connected. I rebuilt the image, but the error persisted. |
I have a fully updated Ubuntu 18.04 LTS as a host and VS Code 1.35.1. Working normally for me. |
Update: I'm having the same issue in one of the containers I have with X-forwarding enabled. On another one I have, everything is working normally (with the same configuration). I also did some minor OS upgrades, but nothing major, it came very out of the blue. I also rebuilt the image, no luck. I am not sure what's causing this and my knowledge of the Linux desktop stack is limited at best. Happy to provide further info and help debugging. |
Update on my update: I manged to get it working again by running, on the host system, the command at the start of @ilinojkovic's initial script: xhost +local: The solution (with some follow-up discussions on security) is available here: jessfraz/dockerfiles#6 This instruction seems to be reset everytime the X server is restarted, hence why this method is working intermittently. |
Just to update the thread, the reason this hasn't been added to docs yet is it is a bit tricky to get working particularly on macOS. We looked at doing this for Microsoft/vscode, but held off because of these issues. More details here: https://github.com/microsoft/vscode/issues/82060#issuecomment-542431498 It all works, but I'm less confident in documenting it as a "supported scenario" at the moment. UI perf was also pretty bad, but part of that may be due to the lack of access to GPU acceleration on Windows/macOS. |
I realize this topic is pretty old but I am working on something similar. In the docker container on a remote host a mujoco simulation should be x11 forwarded to my local windows machine with visual studio code. Everything I tried wasn't working with the runArgs in this topic. Anyone can help or point me in the right direction? |
Implementing X11 forwarding as a new feature. We will also mount the Wayland socket if there is a local one (that is difficult to forward across the network because it relies on shared memory). |
Published with Dev Containers 0.269.0-pre-release. FYI @davidwallacejackson: X11 forwarding implemented here can serve as a lighter weight alternative to VNC. |
Thank you for the heads up! I look forward to giving it a shot. |
Even with the prerelease DISPLAY is still being set incorrectly in my dev container:
I also spotted this error in the Dev Containers log, not sure if it's related:
Related issues: |
@patrick-5546 |
@chrmarti the value of DISPLAY outside the dev container is Also, |
It can be a different display number inside the container than outside. The error refers to a path inside the container |
@chrmarti yes I used the
I even tried Another thing I noticed is that $ ls -l /tmp/.X11-unix/X0
srwxrwxrwx 1 <user> <user> 0 Jan 25 06:07 /tmp/.X11-unix/X0 |
This is cool, it ✨ just works ✨ for me on Ubuntu. |
@patrick-5546 Could you try without mounting |
@chrmarti Side note, my pre-release version is stuck at 0.269.0. When I click "switch to pre-release version" I see v0.273.0, but after reloading VS Code I see v0.269.0. |
@patrick-5546 The latest pre-releases require VS Code Insiders 1.75. VS Code 1.75 stable is expected later this week, so you could switch to Insiders or just wait for the 1.75 release. |
The Insiders Build works great on M1 Mac with XQuartz |
@chrmarti Was this tested on docker rootless? As also on insiders I still need |
@bhack That might also be needed with Docker running rootful? |
It seems it was not required in rootless: https://unix.stackexchange.com/a/685514 Also, what is the case on modern desktop for Wayland? |
I guess whether or not you'll need to grant permissions with Wayland should work when the Wayland socket is on the same machine as the Docker daemon. We have tested this with WSL on Windows, would be interesting to get feedback for other setups. (Wayland uses shared memory, so we can't forward it across the network like we can with X11.) |
Also in this old red hat issue it seems to confirm that |
I should add: The connection to the display's socket path is initiated locally. We listen on a socket path in the container and then forward connections to the local host where we connect to the display's socket path. |
For more information, see microsoft/vscode-remote-release#550
How to set up remote display forwarding from Docker container?
Currently, my
.devcontainer
contains:devcontainer.json
Dockerfile
This doesn't seem to do the job.
Setup details:
I already asked this on stackoverflow, but no response there.
The text was updated successfully, but these errors were encountered: