How do I setup a container to use a gui program

Wanting to run a gui program in a container (A debian testing container run on a snapd on debian stable.)
Installed lxde and xorg which sucks in over 780 packages (wow).

Not able to call the program from the cli.
Error messsage is:
Unable to init server: Could not connect: Connection refused

Am I doing something wrong?
Is there something else to setup?


I am not 100% sure but since the X11 communicates with the server via a unix-domain socket…
this socket has to be made available in the container.

I just playing around with device “forwarding” to the container. This should be the same issue.

You do not need the full desktop in the container to get a GUI app running, but just the necessary X11 libraries.
Then, the Unix socket of the host is shared with the container and that’s it.
See my blog post about this.

OK - - - long hiatus but I had issues with snapd that needed resolving before I could even try what you had suggested.
Was able to work through to the end of glxgears and that was working. Didn’t bother with audio as I really don’t have my system hooked up for it and am not interested in having it.

What my issue is - - is this:
I am wanting to run a package called geany (its a text editor and a small set of other things rolled together and its sortof gui and not totally cli but cli can be invoked through it and it works in plain text - - - all important features for my purpose!) in this gui container.

This isn’t for me (it is but . . . ) but its so that I can ask someone who knows nothing about linux or kumquats or gizmos to log in - - like this, your password is developed like this (with definition) and then they enter information into a text file which is the purpose for this container.

This is fairly a fairly ‘common’ use for a VM but is this what containers are for?
(maybe even @stgraber would care to comment - - - please?)

Maybe I’m misunderstanding the purposes of containers. If I’m being to forthright or bold in my questions - - - well - - - in business one learns that if you don’t ask you just won’t find out, if you need it - - - ask for it.


You are trying to say something here, however I still do not understand.
I think it does not help when you add comments that are not important to the explanation.

To run geany, you do not need hardware acceleration for the GUI. It would probably suffice to use X11 forwarding over SSH. Read the introduction at on the three ways to run a GUI in a LXD container (1. X11 forwarding over SSH, 2. Hardware accelerated, 3. X2Go Desktop in a container).

To distribute a password, it would definitely be overkill to use a VM. You might consider setting up a LXD container with a Web server, and then supply a specific URL that shows the password. Then, you can configure a desktop link on the desktop to open a Web page from that Web server in the container. The Web server in the container would only be accessible from the desktop computer and not from the network.