Skip to content

feat: Set DISPLAY env, so X11 apps show on the host#4509

Merged
rjsparks merged 2 commits into
ietf-tools:mainfrom
larseggert:env-display
Oct 17, 2022
Merged

feat: Set DISPLAY env, so X11 apps show on the host#4509
rjsparks merged 2 commits into
ietf-tools:mainfrom
larseggert:env-display

Conversation

@larseggert

Copy link
Copy Markdown
Collaborator

No description provided.

@larseggert
larseggert requested a review from NGPixel September 27, 2022 12:05
@NGPixel

NGPixel commented Sep 29, 2022

Copy link
Copy Markdown
Member

Note that host.docker.internal is only defined on Docker for Desktop on Mac and Windows. On Linux this entry doesn't exist and need to be added manually when creating the container using --add-host=host.docker.internal:host-gateway.

Would this create issues for Linux users that don't have this hostname defined in their containers?

@larseggert

Copy link
Copy Markdown
Collaborator Author

I doubt it, but maybe we can add that setting to the container settings?

@jennifer-richards

Copy link
Copy Markdown
Member

Tried this on Linux - even adding the host.dockerinternal:host-gateway, I can't open X connections. Am I leaving something out?

Added "host.docker.internal:host-gateway" via docker-compose and get

dev ➜ /workspace $ ping host.docker.internal 
PING host.docker.internal (172.17.0.1) 56(84) bytes of data.
64 bytes from host.docker.internal (172.17.0.1): icmp_seq=1 ttl=64 time=0.102 ms

dev ➜ /workspace $ xterm
xterm: Xt error: Can't open display: host.docker.internal:0

(I opened X on the host with xhost + but it's been a while since I've done much X11 work so I may have missed some setup?)

@jennifer-richards

jennifer-richards commented Oct 14, 2022

Copy link
Copy Markdown
Member

Poked around, I think my problem is that Ubuntu does not accept TCP connections for X11. I haven't found the magic to change this. TCP connections from the container work for nc, though.

@larseggert

Copy link
Copy Markdown
Collaborator Author

You probably need to set xhost + or something similar

@jennifer-richards

Copy link
Copy Markdown
Member

You probably need to set xhost + or something similar

It's more than that - the Ubuntu config has its xserver started with TCP listeners disabled entirely. I chased things for a while but did not find what piece was setting that command line before giving up.

The changes here were not harmful, they just don't make X connections work. I think that's enough to accept this PR. There'll just be further work needed to make X work with a system like mine.

I think it'd be fine to add the host.docker.internal address.

@rjsparks
rjsparks merged commit 67e0d74 into ietf-tools:main Oct 17, 2022
@larseggert
larseggert deleted the env-display branch October 17, 2022 14:59
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants