Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Add support for X11 forwarding from docker .devcontainer to host OS #218

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
"seccomp=unconfined",
],
"containerEnv": {
"DISPLAY": "host.docker.internal:0", // used in X11 for display from container
},
// Set *default* container specific settings.json values on container create.
"settings": {
"cmake.configureOnOpen": true,
Expand All @@ -42,6 +45,10 @@
//"postCreateCommand": "uname -a",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
//"remoteUser": "vscode",
"mounts": [
// x11
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=default"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=delegated",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
Expand Down
11 changes: 11 additions & 0 deletions README_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ run them separately.
A script called `build_examples.sh` is provided to help you to build the example
GUI projects in this container.

## Using X11 Forwarding from .devcontainer

The `.devcontainer` is also configured to use X11 Forwarding to allow GUI to the
host machine, given that you have an X11 server already.

[Here](https://en.wikipedia.org/wiki/List_of_display_servers) is a good list of
X11 servers you could try.

For Windows, [Xming](http://www.straightrunning.com/XmingNotes/) is free and
popular, compiled with MinGW. For MSVC, [vcXsrv](https://sourceforge.net/projects/vcxsrv/)
is a good alternative.