Ask Your Question

run graphical app in systemd-nspawn container

asked 2017-07-09 17:49:32 -0500

miguel-sensacion gravatar image

updated 2017-07-10 01:45:35 -0500

Is it possible o run a graphical application i a systemd-nspawn container? For example i would like to run Firefox from this container, I have installed firefox and xorg-x11. I have read some other information online but it was for Arch with the following:

systemd-nspawn --setenv=DISPLAY=:0 \ --setenv=XAUTHORITY=~/xauthZ53nXr \ --bind-ro=$HOME/xauthZ53nXr:/root/xauthZ53nXr \ --bind=/tmp/.X11-unix \ -D /Contain/F26 \ firefox

Any help is appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-07 03:58:21 -0500

erickj gravatar image

Better late than never....

You're almost there, but if you're running Wayland then Xauthority files don't exist, so you can skip that and instead use xhost to open up access to the XWayland server. This is what's working for me on F28 running Wayland on the host computer w/ an XWayland session:

first use xhost to enable remote connections to your local X server, to debug I started w/ the most permissive setting:

$ xhost +local:

revert this with:

$ xhost -

you can lock this down later with settings listed in man xhost

Then you just need to set the DISPLAY and bind /tmp/.X11-unix as you've done:

$ sudo systemd-nspawn --setenv=DISPLAY=$DISPLAY --bind=/tmp/.X11-unix -D $(pwd)/firefox-base firefox

I've tried running firefox-wayland which requires some different bindings... this kind of "works", but only in the most minimal sense. The resolution of the contained wayland app is comically large, and there is screen tearing on every key press and scroll event.

edit flag offensive delete link more

answered 2017-07-31 04:20:54 -0500

I've not tried it, but have you seen this

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-07-09 17:49:32 -0500

Seen: 1,180 times

Last updated: Jun 07 '18