I am looking for a way to run a Wayland compositor (like Hyprland) inside a docker container. I know I can run it inside Distrobox, but I don't want to run the whole system inside of the container, only the compositor. Is there a way to do it?
2 Answers
I was able to run hyprland inside an archlinux container in debian by just installing seatd in debian and enabling it. The problem I am facing now is alot of programs like vscode and waybar refuse to launch and I don't know why.
Could you please try this 'Dockerfile' from terminal with the command docker build -t hyprland-container . and docker run -it hyprland-container
# Utiliser Ubuntu 25.04 comme image de base
FROM ubuntu:25.04
# Mettre à jour le système et installer les dépendances nécessaires
RUN apt update && apt upgrade -y \
&& apt install -y wget git software-properties-common \
&& apt autoremove -y && apt clean
# Installer les paquets nécessaires pour Hyprland
RUN apt install -y build-essential meson ninja-build \
libwayland-dev libxkbcommon-dev libwlroots-dev libvulkan-dev \
cmake pkg-config libgles2-mesa-dev libdrm-dev libxcb1-dev libx11-dev \
libxrandr-dev libxinerama-dev libxcursor-dev libevdev-dev libudev-dev \
libinput-dev libpugixml-dev hwdata \
libzip-dev libcairo2-dev librsvg2-dev libtomlplusplus-dev \
qtbase5-dev qtdeclarative5-dev qt5-qmake qttools5-dev-tools \
libglib2.0-dev libgtk-3-dev libpolkit-gobject-1-dev \
libjpeg-dev libwebp-dev libjxl-dev libmagic-dev \
libgoogle-perftools-dev
# Installer absl
RUN git clone https://github.com/abseil/abseil-cpp.git /tmp/abseil-cpp && \
cd /tmp/abseil-cpp && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install
# Installer re2
RUN git clone https://github.com/google/re2.git /tmp/re2 && \
cd /tmp/re2 && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install
# Installer hyprutils
RUN git clone https://github.com/hyprwm/hyprutils.git /tmp/hyprutils && \
cd /tmp/hyprutils && \
cmake -S . -B build && \
cmake --build build && \
cmake --install build
# Installer hyprlang
RUN git clone https://github.com/hyprwm/hyprlang.git /tmp/hyprlang && \
cd /tmp/hyprlang && \
cmake -S . -B build && \
cmake --build build && \
cmake --install build
# Installer hyprcursor
RUN git clone https://github.com/hyprwm/hyprcursor.git /tmp/hyprcursor && \
cd /tmp/hyprcursor && \
cmake -S . -B build && \
cmake --build build && \
cmake --install build
# Installer hyprgraphics
RUN git clone https://github.com/hyprwm/hyprgraphics.git /tmp/hyprgraphics && \
cd /tmp/hyprgraphics && \
cmake -S . -B build && \
cmake --build build && \
cmake --install build
# Installer hyprwayland-scanner
RUN git clone https://github.com/hyprwm/hyprwayland-scanner.git /tmp/hyprwayland-scanner && \
cd /tmp/hyprwayland-scanner && \
cmake -S . -B build && \
cmake --build build && \
cmake --install build
# Installer Aquamarine
RUN git clone https://github.com/hyprwm/aquamarine.git /tmp/aquamarine && \
cd /tmp/aquamarine && \
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build && \
cmake --build ./build --config Release --target all -j$(nproc) && \
cmake --build ./build --config Release --target install
# Cloner et construire Hyprland
RUN git clone https://github.com/hyprwm/Hyprland.git /opt/hyprland && \
cd /opt/hyprland && \
meson setup build --prefix /usr && \
ninja -C build && \
ninja -C build install
# Définir le point d'entrée (si nécessaire, sinon ajouter une commande appropriée)
CMD ["/bin/bash"]