[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: graphical session in LXC automatically started at boot and reachable via VNC/RDP/X2GO



Yvan Masson writes:

[...]

What I did not understand from your answers (sorry maybe I missed something) is how to start the graphical session automatically when the container starts, so that the software can be started and listening on the network, and then later someone can attach to this session with VNC/RDP/X2GO. It seems your script Linux-Fan starts a VNC server, but does it start a session in it?

I did not mention it explicitly, because with the VNC server I am using (`tightvncserver`) does this automatically.

The trick most important steps are as follows:

* Prepare a configuration for the session of interest to start, I have these
  lines in my "Dockerfile" (i.e. image preparation stage):

	echo \$vncStartup = \"exec /usr/bin/icewm\" > $HOME/.vncrc; \
	[...]
	printf "%s\n\n%s\n" "#!/bin/sh -e" "/usr/bin/megasync &" \
						> /etc/X11/icewm/startup; \

  This way, it configures `icewm` to be the window manager to use and
  uses IceWM's autorun facility to start my program of interest (`megasync`).

* In the container's startup script, run the VNC server.

	/usr/bin/vncserver -geometry 1024x768 :0

  This will start `icewm` (as configured in `.vncrc`) which (by configuration
  in `/etc/X11/icewm/startup`) runs `megasync`.

  See also: vncserver(1) --
  https://manpages.debian.org/buster/tightvncserver/tightvncserver.1.en.html

* To automatically start the container upon OS boot, I use Docker's
  `--restart=unless-stopped`. This will be different for LXC of course!

* For the gory details of setting passwords, making the right files
  executable or resuming from "crashed" sesions (i.e. delete temp files)
  check the respective source codes:

  https://github.com/m7a/lo-megasync/blob/master/megasync_ctrl.sh
  https://github.com/m7a/lo-megasync/blob/master/Dockerfile

HTH
Linux-Fan

öö

Attachment: pgpVzWZbTnhXZ.pgp
Description: PGP signature


Reply to: