mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Is there any way to assign or get the DISPLAY variable of the new X server? #402

Closed CicadaSeventeen closed 2 years ago

CicadaSeventeen commented 2 years ago

When not using --hostdisplay, new X server gets a new DISPLAY variate. I try using --env DISPLAY=:100 to assign the DISPLAY variate of the new X server, but that not work. Or else, it is OK not to assign that, however, instead, to know the DISPLAY variate of the new X server. If I open a terminal like x11docker --exe xterm or x11docker -- x11docker/xfce xfce4-terminal, it is OK to use env|grep DISPLAY, but it does not work otherwise. So if there are anyway to get. Now the only way working I have find is like x11docker --exe "env|grep DISPLAY > _FILENAME_ ; xterm" if I do not run program of any image. For running programs in images x11docker -- x11docker/xfce "env|grep DISPLAY > _FILENAME_ ; xfce4-terminal" does not work at all, showing cannot find such command. So, if there any way to control, even if just to know, the DISPLAY variate of the new X server?

mviereck commented 2 years ago

Compare x11docker --help:

Output of parseable information on stdout:
  Get output e.g. with:  read xenv < <(x11docker --showenv x11docker/check)
     --showenv         Print new $DISPLAY, $XAUTHORITY and $WAYLAND_DISPLAY.
X and Wayland special configuration:
     --display=N       Use display number N for new X server.
CicadaSeventeen commented 2 years ago

Thanks so much.

mviereck commented 2 years ago

x11docker -- x11docker/xfce "env|grep DISPLAY > FILENAME ; xfce4-terminal" does not work at all, showing cannot find such command.

To run multiple commands, try with sh -c '...'

x11docker -- x11docker/xfce sh -c "env|grep DISPLAY > _FILENAME_ ; xfce4-terminal"