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 ALPON Cloud.
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.
Install an Xorg server on your ALPON X5 AI or ALPON X4,
then share the host's X11 socket and authorization cookie with the container. Set
DISPLAY, mount /tmp/.X11-unix and the matching .Xauthority file,
and grant only the local container user that needs display access. X11 alone does not require
Privileged mode. A physical display must be connected for this procedure.
A display must be physically connected to the ALPON for this setup. Without an active X server, authorization commands fail with “unable to open display”.
-
1
Install Xorg and start it at boot
X11 needs a functional Xorg server. Install it:
bash · install Xorgsudo apt install x11-xserver-utils
Verify the installation:
bash · check versionXorg -version
To start Xorg at boot, create a systemd service file:
bash · create service filesudo 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 & startsudo 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
Share the X11 socket with containers
Option 1 — scoped
xhostaccess (temporary)If the container runs as root, grant only the local root identity access for the current X session:
bash · scoped xhost accessDISPLAY=:0 XAUTHORITY=/root/.Xauthority xhost +SI:localuser:root # Revoke after stopping the container DISPLAY=:0 XAUTHORITY=/root/.Xauthority xhost -SI:localuser:root
Do not usexhost +xhost +disables X11 access control for every client. Use the scoped identity rule above and revoke it when the container stops.Option 2 — scoped systemd service
For a dedicated display deployment, persist the same scoped identity rule and revoke it when the service stops:
bash · create service filesudo nano /etc/systemd/system/xhost.service
config · /etc/systemd/system/xhost.service[Unit] Description=Allow local container root to access X11 After=xorg.service Requires=xorg.service [Service] Type=oneshot Environment=DISPLAY=:0 Environment=XAUTHORITY=/root/.Xauthority ExecStart=/usr/bin/xhost +SI:localuser:root ExecStop=-/usr/bin/xhost -SI:localuser:root RemainAfterExit=true [Install] WantedBy=multi-user.target
Enable and start it:
bash · enable & startsudo systemctl enable xhost.service sudo systemctl start xhost.service
-
3
Configure the deployment for X11 access
In ALPON Cloud, open the Applications tab of your asset and start a new deployment. Configure it as follows:
Deployment settings in ALPON Cloud for an X11-enabled container. Container name & image — choose a name, then select the image and tag holding your X11 application (from the Sixfab Container Registry or a custom path).
Environment — set
DISPLAYso output appears on the host's screen. Confirm the value on the device withecho $DISPLAY(typically:0).DISPLAY:0Volumes — mount the X11 socket and the
.Xauthorityfile so the container can reach the graphical environment:X11 socket (read-only)/tmp/.X11-unix→/tmp/.X11-unixAuthorization file (read-only)/root/.Xauthority→/root/.XauthorityPrivileges — leave Privileged disabled unless the application requires separate hardware access that cannot be expressed with a targeted device or bind mount. Deploy, verify the GUI, and revoke temporary
xhostaccess when finished.
Troubleshooting
Make sure a display is physically connected. Without one, xhost + fails to open the display:
xhost: unable to open display ""
If a display is connected, export the variable and retry:
export DISPLAY=:0
The xhost.service may also fail when no display is available:
× 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.
Updated 9 days ago
