Docker Community Forums

Share and learn in the Docker community.

GUI app in docker and container communication


I’m working on Ubuntu 20.04,
I would need to start 2 applications in 2 different containers (same image) both with GUI to be seen on the host and one exposes port 11000 and the other needs to be connected to that port.

Is this possible?
I have tried several things, but I think that in order to show the GUI on the host you have to use network-mode: host, but if I do that one application does not see the other on that port.
Any proposal to try?

Thanks in advance.

Isn’t there anyone with more experience who has also had the need to connect two services with GUI and have to connect to each other?

Thanks again.

You need to share your host X11 socket with the container and export your display variables.
-v stands for Bind mount a Volume
-e stands for Export Environment variables
$docker run -it \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ <> bash


1 Like