Created
January 22, 2017 12:37
-
-
Save masaeedu/418b2013df052bda845b63fc9a5ddbac to your computer and use it in GitHub Desktop.
Starting GUI apps in with docker-machine or Docker for Windows
This file contains hidden or 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
| # Start X server. Requires xming or cygwin with the xorg packages installed | |
| Function bootx { | |
| XWin :0 -multiwindow -clipboard -wgl -ac -listen tcp | |
| } | |
| # Find local machine's IP on network interface connected to docker server | |
| Function Get-DockerRoutableIP { | |
| if (Get-Command docker-machine -errorAction SilentlyContinue) { | |
| return (Find-NetRoute -RemoteIPAddress $(docker-machine ip default)).IPAddress | |
| } | |
| return Get-NetIPAddress | ? { $_.InterfaceAlias -like '*docker*' -and $_.AddressFamily -eq 'IPv4' } | % { $_.IPAddress } | |
| } | |
| # Run GUI app by setting DISPLAY env var to IP address of the user's display server machine | |
| Function direfox { | |
| docker run -it --rm -e DISPLAY=$(Get-DockerRoutableIP):0 chrisdaish/firefox | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment