Different linux containers run gui apps on different displays (ubuntu)

Hi I want to run gui apps on two containers but i want second container to access a different display (connected through HDMI to a ubuntu laptop) . i am successfully able to run both the containers with gui apps on the ubuntu laptop simultaneously and they both access the same host display (:0) .The second display that i connect through HDMI doest list out under DISPLAY env. How can i proceed further ? Thanks in advance.


The DISPLAY is for all connected and accessible monitors, of a specific GPU.

I suppose what you need is dedicated placement of an applicatio to a particular monitor.
That’s a window manager issue, and you can use some feature of the window manager to identify the specific window and place it at the desired screen/monitor.

What window manager are you using?
Common Google terms are: X11 window placement permanent

Hello Simos,

appreciate the reply.

If DISPLAY is for all monitors, what would be the reason for the external monitor connected not listing there ?

I can use a window manager but my final goal is to run two containers on some hardware (flashed with some linux base image ) which has two displays connected to it and when i boot up, i want the containers to run their respective apps on different DISPLAYS (how can i do this ?). But for demo purpose i want to show it in my ubuntu laptop. how can i do that ?
Any suggestions ?

Can you show me that commands you are using for this, and their output?
Do you mean that the monitor over HDMI does not show any output at all?

No the monitor is acting as an extended monitor or a mirroring screen . But i want it to display the gui application only. So as its an external display i thought it would show under DISPLAY and i can configure the container profile to display the gui app running in the container over there, but i have no idea how to handle that.

On the X side, you can try with DISPLAY=:0.1 (second screen) in the container.
It might also work if you set your host’s DISPLAY to “:0.0” so that the window manager does not send windows to the extended display.

If the application has the --geometry parameter, you can specify it when you run it.
For example, the following places the window at point 100, 100, with size 200x200.
xclock -geometry 100x100+200+200

If you have two FullHD monitors, then 1920x0+1920+1080 should make the application full screen on the extended display.

I tried this and when i run my application videogui it says
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-ubuntu’
qt.qpa.screen: QXcbConnection: Could not connect to display :0.1
Could not connect to any X display.

For your reference these are the listed monitors:
:~$ xrandr --listactivemonitors
Monitors: 2
0: +*LVDS1 1600/309x900/174+0+0 LVDS1
1: +VGA1 1600/432x900/240+1600+0 VGA1

$echo $DISPLAY

I can see the laptop’s monitor and a VGA monitor. Where’s the HDMI monitor?

i am very sorry for the confusion simos, the monitor is connected via VGA, and i am able to show the app on the VGA monitor using the geometry option. Thanks for the suggestion . But now i am facing a different issue with lxd containers autostart, will start a different topic on that, please check that. Autostart of lxd containers failing