2019年1月20日 星期日

[docker] 如何在 Docker 裡面執行 GUI 應用程式



所有的 Unix-like GUI Application 都需要 XServer, 但 container 裡面沒有. 所以我們把 host 上的 XServer 對應給 container. 

作法如下:
  • Share the Host’s XServer with the Container by creating a volume
  • --volume="$HOME/.Xauthority:/root/.Xauthority:rw"
  • share the Host’s DISPLAY environment variable to the Container
  • --env="DISPLAY"
  • run container with host network driver with
  • --net=host


Reference

https://medium.com/@SaravSun/running-gui-applications-inside-docker-containers-83d65c0db110