I have a docker container based on debian and it works when I run it like,
“docker run -ti --name devworkstation --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock -e DISPLAY=$env:DISPLAY xxxx/xxxx:devworkstation”
By works, I mean that the bash command prompt comes up and when I run xeyes, I see the window on my windows 10 computer as I expect. (x11 forwarding works.)
($env:DISPLAY = “myWinIP:0.0”)
I then created a new external virtual switch named, “dockerExternalSwitch,” and a docker machine with, “docker-machine create -d hyperv --hyperv-virtual-switch dockerExternalSwitch dev1”
I set up my environment according to docker-machine env dev1. I then run the same docker run command as above on the docker machine. It brings up my command prompt as I expect, but when I run xeyes, I get an error:
Error: Can’t open display: xxx.xxx.xxx.xxx:0.0
I also have firefox installed on the debian image. It gives a similar error: Unable to init server: Broadway display type not supported: xxx.xx.xx.xxx:0.0 Error: cannot open display: xxx.xxx.xxx.xxx:0.0
Since it works when I run it directly (w/o a docker machine) and fails when I use the docker machine, I’m wondering if it is network related.
Dockerfile contents:
from debian:9.5
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y firefox-esr
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y vim git curl
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gdb valgrind
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y qt4-default
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y dos2unix tcpdump netcat
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y linux-image-rt-amd64
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y task-mate-desktop
RUN env
CMD /bin/bash
I’ve tried about all of the x11 forwarding suggestions I could find on the internet. And I've searched stack overflow for suggestions. I haven't found a solution and it appears to be related to the docker machine. Any suggestions on what I could try would be greatly appreciated.
(FYI, The reason I'm working with the docker-machine is that I have sample code that connects to a network camera that works as a docker-machine but not when I run without the docker machine. )