Skip to content

Instantly share code, notes, and snippets.

@masaeedu
Created January 22, 2017 12:37
Show Gist options
  • Select an option

  • Save masaeedu/418b2013df052bda845b63fc9a5ddbac to your computer and use it in GitHub Desktop.

Select an option

Save masaeedu/418b2013df052bda845b63fc9a5ddbac to your computer and use it in GitHub Desktop.
Starting GUI apps in with docker-machine or Docker for Windows
# 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