Job Scheduling with Docker


Docker containers are an efficient way to package applications and limit resources in a multi user system. In FastX, Docker has a supported launcher template which enables system administrators to easily create sessions as containers. The launcher script sets up the user id, $HOME directory, networking, X forwarding and connection back to the cluster doing the major work that is needed to make containers work with X11 environments in a multi user system. Administrators simply need to bring their containers and containerized sessions can be up and running in minutes.

System Requirements

  1. docker should be installed on systems that will launch the containers
  2. The fastx user will be in the docker group

Container Requirements

  1. perl is required to be installed in all containers. In order to simplify distribution, FastX will mount the required libraries to start a session. These libraries depend on perl.
  2. Any X applications that you want to run in the container need to be installed beforehand. Remember, because this is a container, typical applications are not installed by default

Limitations

  1. Full desktops (GNOME, KDE) are often limited in the container space as it requires systemd and multiple users installed in order to function properly. You should avoid running the full desktop when running containers.
  2. The exception to Rule #1 is XFCE which typically will run without issue in a container. Because only a subset of applications are installed by default, the admin will need to add any required packages to the container before use.

docker.tpl

The launcher script takes a template file called docker.tpl. This is a YAML based template file that sets up the docker template script that will run to launch the container.

The template file used for launching a docker session is located in
$FX_CONFIG_DIR/launcher-templates/docker.tpl
(The original tpl file is located in /usr/lib/fastx/4/install/config/launcher-templates/docker.tpl)

The purpose of this file is to take the user data from a session launch command and inject it into the docker template which will launch the session. Extra data (like TMP directory) is also included and comes from the web server. Admins can modify this file as needed to add extra docker parameters for launching sessions.

Job Scheduling

When using the Docker launcher, all sessions will be scheduled since the docker command needs to start in the background to do scheduling. The docker.tpl template is built to run the FastX session within the container itself. This allows all the information and memory requirements of the session to be self contained. It also allows the container to clean itself up when the container, session, or session applications terminate.

Once the session has started, the FastX session within the container will contact the host network and relay session information back to the FastX web server. Users can communicate, change session state (suspend, terminate), connect and display images just like it was running directly on the system. The container is transparent to the end user.