Running GUI Apps with X11 in Containers

Run graphical applications inside containers on ALPON X5 AI and ALPON X4 using the X11 display protocol — install Xorg, share the X11 socket, and configure the deployment in Sixfab Connect.

Running GUI Apps with X11 in Containers

Render graphical applications from inside a container on a display connected to your ALPON X5 AI or ALPON X4. Using the X11 display protocol, a containerized app stays isolated and portable while drawing its GUI on the device's screen.

ALPON X5 AI ALPON X4 X11 · Xorg Containers
ALPON · Tutorial · X11 · Containers
How do I run a GUI app in a container on ALPON?

Install an Xorg server on your ALPON X5 AI or ALPON X4, then share the host's X11 socket with the container — temporarily with xhost + or permanently via a systemd service. When deploying through Sixfab Connect, set the DISPLAY environment variable to :0, mount /tmp/.X11-unix and /root/.Xauthority, and enable Privileged mode. A physical display must be connected for X11 to work.

A physical display is required

A display must be physically connected to the ALPON for this setup to work. Without one, commands like xhost + and the related services will fail with errors such as “unable to open display”.

  1. 1

    Install Xorg and start it at boot

    X11 needs a functional Xorg server. Install it:

    bash · install Xorg
    sudo apt install x11-xserver-utils

    Verify the installation:

    bash · check version
    Xorg -version

    To start Xorg at boot, create a systemd service file:

    bash · create service file
    sudo nano /etc/systemd/system/xorg.service
    config · /etc/systemd/system/xorg.service
    [Unit]
    Description=Xorg Display Server
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/Xorg :0
    Restart=always
    User=root
    Environment=DISPLAY=:0
    
    [Install]
    WantedBy=multi-user.target

    Enable, start, and check the service:

    bash · enable & start
    sudo systemctl enable xorg.service
    sudo systemctl start xorg.service
    sudo systemctl status xorg.service

    A black screen after starting the Xorg service is expected.

  2. 2

    Share the X11 socket with containers

    Option 1 — xhost (temporary)

    Grant containers access to the X11 display for the current session:

    bash · xhost
    xhost +
    Security warning

    xhost + disables access control on the X11 server, letting any user or application connect. Use it only for testing or in trusted environments — never in production.

    Option 2 — systemd service (permanent)

    Create a service that runs xhost + at startup:

    bash · create service file
    sudo nano /etc/systemd/system/xhost.service
    config · /etc/systemd/system/xhost.service
    [Unit]
    Description=Allow X11 access to containers
    After=graphical.target
    
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/xhost +
    RemainAfterExit=true
    
    [Install]
    WantedBy=multi-user.target

    Enable and start it:

    bash · enable & start
    sudo systemctl enable xhost.service
    sudo systemctl start xhost.service
  3. 3

    Configure the deployment for X11 access

    In Sixfab Connect, open the Applications tab of your asset and start a new deployment. Configure it as follows:

    Sixfab Connect deployment settings for an X11 application, showing environment variables and volume mounts
    Deployment settings on Sixfab Connect for an X11-enabled container.

    Container name & image — choose a name, then select the image and tag holding your X11 application (from the Sixfab Registry or a custom path).

    Environment — set DISPLAY so output appears on the host's screen. Confirm the value on the device with echo $DISPLAY (typically :0).

    DISPLAY :0

    Volumes — mount the X11 socket and the .Xauthority file so the container can reach the graphical environment:

    X11 socket /tmp/.X11-unix/tmp/.X11-unix
    .Xauthority /root/.Xauthority/root/.Xauthority

    Privileged mode — enable Privileged to give the container full access to the X11 server, then click Deploy. The GUI should now render on the connected display.


Troubleshooting

Make sure a display is physically connected. Without one, xhost + fails to open the display:

terminal · error
xhost: unable to open display ""

If a display is connected, export the variable and retry:

bash · set DISPLAY
export DISPLAY=:0

The xhost.service may also fail when no display is available:

terminal · systemctl status xhost.service
× xhost.service - Allow X11 access to containers
     Loaded: loaded (/etc/systemd/system/xhost.service; enabled; preset: enabled)
     Active: failed (Result: exit-code)
    Process: 52110 ExecStart=/usr/bin/xhost + (code=exited, status=1/FAILURE)

xhost[52110]: /usr/bin/xhost:  unable to open display ""
systemd[1]: xhost.service: Failed with result 'exit-code'.
systemd[1]: Failed to start xhost.service - Allow X11 access to containers.

These errors mean the X11 display is unavailable — usually because no physical display is connected or the setup is misconfigured.