DEV Community

Discussion on: Run GUI app in linux docker container on windows host

Collapse
 
chris2048 profile image
Chris2048 • Edited

I'm finding it difficult to auto-insert the DockerNAT IP inside the container, but this seems to work:

--add-host=dockerhost:$((Get-NetIPAddress -AddressFamily IPv4 -InterfaceA
lias "vEthernet (DockerNAT)" | Select IPAddress).IPAddress;) -e DISPLAY=dockerhost:0.0
Enter fullscreen mode Exit fullscreen mode

or

--add-host=dockerhost:$(Get-NetIPAddress -AddressFamily IPv4 -InterfaceAl
ias "vEthernet (DockerNAT)" | Select-Object -ExpandProperty 'IPAddress';) -e DISPLAY=dockerhost:0.0
Enter fullscreen mode Exit fullscreen mode

EDIT: this works too:

DISPLAY=host.docker.internal:0.0
Enter fullscreen mode Exit fullscreen mode