Created
October 3, 2015 08:07
-
-
Save tomzo/7812292a2fc8d9118f2c to your computer and use it in GitHub Desktop.
Running docker with X on host and GPU acceleration - PoC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install host GPU drivers | |
# ... | |
# Start a bare X-server | |
X :0 & | |
# Make it possible to connect from other hosts | |
export DISPLAY=:0 | |
xhost + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# There is extra requirements for the image | |
# 1. Must have installed exactly the same drivers that host has | |
# 2. Should have some desktop environment installed. I use xfce4, it works well in this case. | |
docker run -ti \ | |
--privileged \ | |
-e "DISPLAY=unix:0.0" \ | |
--volume "/tmp/.X11-unix:/tmp/.X11-unix:rw" \ | |
yourimage /bin/bash | |
# Now | |
if you start any X application then it should show up. | |
You can test GPU acceleration by installing mesa-utils and running glxgears | |
If the image has xfce4 then you can start a full-blown desktop environment by running `startxfce4` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment