Run an Avalonia MVVM on Linux amd64 (Ubuntu)

Hi, Iā€™m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hi Ahmed49,

Yes, it is possible to run an Avalonia application in a Linux amd64 environment (Ubuntu) using the Wayland compositor Weston within Docker containers. Additionally, you can configure the application to autorun by customizing the weston.ini file.

Here are the steps to achieve this:

  1. Create a Dockerfile for your Avalonia application:

    • Ensure your Dockerfile sets up the necessary environment for running Avalonia on Linux.
    • Install dependencies such as .NET runtime and any other required libraries.
  2. Create a Dockerfile for Weston:

    • Use a base image that includes Weston, such as torizon/weston.
    • Ensure the Dockerfile sets up Weston to run as a Wayland compositor.
  3. Customize the weston.ini file:

    • Create a weston.ini file with the necessary configuration.
    • Use the [autolaunch] section to specify your Avalonia application.

Here is an example of how you might set up the weston.ini file:

[core]
backend=drm-backend.so

[autolaunch]
path=/path/to/your/avalonia/application
  1. Run the Docker containers:
    • Start the Weston container with the customized weston.ini file.
    • Ensure the Avalonia application container is set to communicate with the Weston container.

Here is an example of how you might run the containers using Docker Compose:

version: '3.8'
services:
  weston:
    image: torizon/weston
    volumes:
      - ./weston.ini:/etc/xdg/weston/weston.ini
    devices:
      - /dev/dri:/dev/dri
    environment:
      - ACCEPT_FSL_EULA=1
    command: weston --tty=1 --backend=drm-backend.so

  avalonia-app:
    image: your-avalonia-app-image
    environment:
      - WAYLAND_DISPLAY=wayland-0
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
    depends_on:
      - weston
  1. Ensure the Avalonia application is set to autorun:
    • In the weston.ini file, the [autolaunch] section should point to the executable of your Avalonia application.

By following these steps, you should be able to run your Avalonia application in a Docker container with Weston as the Wayland compositor and have it autorun using the weston.ini configuration.

If you need further assistance or specific examples, please let me know!

Best regards,
[Your Name]

Please, also check if these links can help you solve your problem:

Avalonia: [OpenGL] Unable to initialize GLX-based rendering.