Running qt gui app in docker container for R-car h3 board

Hello I am running the qt GUI app inside the docker container on my linux host. Below is the docker file

# Use an official Ubuntu image as the base
FROM ubuntu:22.04 AS base

# Install necessary dependencies for Qt applications
RUN apt-get update && apt-get install -y \
    libx11-xcb1 \
    libxkbcommon-x11-0 \
    libxcb-xinput0 \
    libfontconfig1 \
    libfreetype6 \
    libxext6 \
    libx11-6 \
    libxcb1 \
    libglib2.0-0 \
    libglx0 \
    libgl1 \
    libopengl0 \
    libegl1-mesa \
    libgles2-mesa \
    libgl1-mesa-glx \
    libgl1-mesa-dri \
    libxcb-glx0 \
    libxcb-shm0 \
    libwayland-client0 \
    libwayland-server0 \
    libdbus-1-3 \
    libxrender1 \
    libxrandr2 \
    libxcomposite1 \
    libxcursor1 \
    libxi6 \
    libxss1 \
    libxtst6 \
    libxcb-shape0 \
    libxcb-render-util0 \
    libxcb-render0 \
    libxcb-randr0 \
    libxcb-xinerama0 \
    libxcb-util1 \
    libxcb-cursor0 \
    libxcb-icccm4 \
    libxcb-keysyms1 \
#    x11-utils \
    && rm -rf /var/lib/apt/lists/*

# Set UTF-8 locale to prevent locale issues
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

# Ensure Qt can find the platform plugins
ENV QT_QPA_PLATFORM=xcb
ENV QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt/6.8.2/gcc_64/plugins/platforms

# Copy Qt from the local directory
COPY Qt/6.8.2 /opt/Qt/6.8.2

# Set environment variables for Qt
ENV QT_HOME=/opt/Qt/6.8.2/gcc_64
ENV PATH=$QT_HOME/bin:$PATH
ENV LD_LIBRARY_PATH=$QT_HOME/lib:$LD_LIBRARY_PATH

# Set working directory inside the container
WORKDIR /app

# Copy your application to the container
COPY <my_app> /app/

# Grant execute permission to the application
RUN chmod +x /app/<my_app>

# Enable debugging for Qt plugins
ENV QT_DEBUG_PLUGINS=1

# Run the application when the container starts
CMD ["./<my_app>"]

But when I try to build it with buildx I am getting errors. Image is not building. Can anyone please suggest how can I run this app in container on r-car h3 board.

I used below build command :

sudo docker buildx build --platform linux/arm64 -t doc-qt-arm64 --load .

regards,
Siddhartha V

Since you copy files into the image, no one will be able to build your Dockerfile.
Please share the error from the build log as well.

Furthermore, I formatted your post, as you used a quote block, instead of a code block.


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

Hello @meyay , Here is the error am getting

=> ERROR [base 2/6] RUN apt-get update && apt-get install -y libx11-xcb1 libxkbcommon-x11-0 libxcb-xinput0 libfontconfig1 libfreetype6 libxext6 libx11-6 libxcb1 96.8s

>  40 | >>>     libxcb-cursor0 \
>   41 | >>>     libxcb-icccm4 \
>   42 | >>>     libxcb-keysyms1 \
>   43 | >>> #    x11-utils \
>   44 | >>>     && rm -rf /var/lib/apt/lists/*
>   45 |     
> --------------------
> ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update && apt-get install -y     libx11-xcb1     libxkbcommon-x11-0     libxcb-xinput0     libfontconfig1     libfreetype6     libxext6     libx11-6     libxcb1     libglib2.0-0     libglx0     libgl1     libopengl0     libegl1-mesa     libgles2-mesa     libgl1-mesa-glx     libgl1-mesa-dri     libxcb-glx0     libxcb-shm0     libwayland-client0     libwayland-server0     libdbus-1-3     libxrender1     libxrandr2     libxcomposite1     libxcursor1     libxi6     libxss1     libxtst6     libxcb-shape0     libxcb-render-util0     libxcb-render0     libxcb-randr0     libxcb-xinerama0     libxcb-util1     libxcb-cursor0     libxcb-icccm4     libxcb-keysyms1     && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100

Thanks for formating. I missed it.sorry.

So your apt command fails. Whenever anything fails during docker build, the way to solve it is

  1. Changing the command as long as you find which package or which command causes it so you can find out why.
  2. Run the commands interactively in a running container so you can see if it happens there or only in build time .

Since the error message shows emulation, it is also possible the issue happens because of that.

I also miss the actual error thrown by the command in the builder container. If apt fails because of a missing package or the rm command fails, there is always an error message, but what you shared is the error message shown by Docker because of the non-zero error code. The more useful error message should be above what you shared, so please, share the full output.

If there is no other error message, my guess is still the emulation. Unfortunately not everything can be emulated perfectly.