Docker Community Forums

Share and learn in the Docker community.

Launch Chrome as GUI in Docker Container

Hi Team,

Is there any possible way to Launch Chrome as GUI in Docker Container.If any possible way is there please suggest!!!

Thanks
Aman

Say your ip address is 192.168.0.2.

You can set up a tunnel to you X display on i.e. port 6010, (which corresponds to display 192.168.0.2:10) with socat. For security, the range argument asks socat to only accept connections from your machine’s IP address.

socat TCP-LISTEN:6010,reuseaddr,fork,range=192.168.0.2/32 UNIX-CLIENT:"$DISPLAY" &
Now you can set the DISPLAY variable inside the docker container with -e when you start it.

docker run -e DISPLAY=192.168.0.2:10 gns3/xeyes
In the case of chrome there are some more complications, described in the linked post, because chrome requires some more privileges (i.e. add --privileged )