Skip to content

Instantly share code, notes, and snippets.

@bhubr
Last active December 28, 2020 17:46
Show Gist options
  • Save bhubr/cd857e1f118c66dc684f3f36b80d2f9f to your computer and use it in GitHub Desktop.
Save bhubr/cd857e1f118c66dc684f3f36b80d2f9f to your computer and use it in GitHub Desktop.
Export a dockerized app's display - X11 forwarding from Docker in WSL2

X11 forwarding from Docker in WSL2

A bit of context (for myself and whoever it might help):

  • I've been using WebdriverIO (WDIO) to test Node.js-based web apps (and for other stuff too).
  • WDIO has a nice Getting Started page. When you launch your WDIO-based tests or app, WDIO launches a browser (Chrome by default).
  • Since my app became a kind of "microservices app" (one of them being the WDIO app), I wanted to use Docker to manage them.

Sources

Interesting stuff I found here and there:

Appendix 1 - Try something with a sample X11 app

I wanted to try running a simple X11 app from a Docker container.

I copy-pasted code from a tutorial (first link) and added a Dockerfile. I won't get into how to create a Dockerfile. It uses the latest Alpine image, installs g++ and libx11-dev, compiles the app and runs it.

Since the containerized Linux had no display, the container shut down as soon as I first started it (I used Docker events to make sure the error message was Cannot open display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment