commit f4e1e1a4f4d1b01edfbd348fd71ad552e066d610 Author: Artur Mukhamadiev Date: Tue Oct 7 20:35:19 2025 +0300 init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8089f15 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:24.04 + +RUN apt-get update && \ + apt-get install -y \ + libglvnd0 \ + libgl1 \ + libglx0 \ + libgles2 \ + libegl1 \ + libxcb1 \ + libx11-xcb1 \ + libxkbcommon-x11-0 \ + gstreamer1.0-tools \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev && \ + rm -rf /var/lib/apt/lists/* + +ENV DISPLAY=:0 + +CMD ["bash"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e5fa79a --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +## Base info +Here you can find simple gstreamer dockerfile and necessary scripts to work with GUI. +Scripts will not work on windows directly. It is assumed that you will be using WSL for work. + +Other way, would be using run.bat script as shown under this thread +https://stackoverflow.com/questions/73092750/how-to-show-gui-apps-from-docker-desktop-container-on-windows-11 + +## Usage + +1. Run build.sh script with container name: e.g. + - `build.sh gstreamer-base` +2. Run run.sh script with same container name: e.g. + - `run.sh gstreamer-base` + - if you're using Windows you can try (to be fair, I don't know much about powershell scripting, so this is generated by AI): + - `run.ps1 -ContainerName gstreamer-base -Build` +3. In opened bash verify that gui is opening correctly: + - `gst-launch1.0 videotestsrc ! autovideoconvert ! autovideosink` + +If video sink is not visible on the screen: +1. Make sure that wsl2 is active. +2. Make sure that WSLg is supported (should be built-in on windows 11) \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..ad0e8bf --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ $# -ne 1 ]]; then + echo "using: $(basename $0) " + exit 1 +fi + +docker build -t $1 . \ No newline at end of file diff --git a/run.ps1 b/run.ps1 new file mode 100644 index 0000000..563c2bb --- /dev/null +++ b/run.ps1 @@ -0,0 +1,29 @@ +param( + [string]$ContainerName = "gui-app-container", + [switch]$Build +) + +if ($Build) { + Write-Host "Building Docker image: $ContainerName" -ForegroundColor Green + docker build -t $ContainerName . + + if ($LASTEXITCODE -ne 0) { + Write-Host "Build failed!" -ForegroundColor Red + exit 1 + } +} + + +$dockerCommand = @( + "run", "-it", "--rm", + "--name", $ContainerName, + "-v", "/tmp/.X11-unix:/tmp/.X11-unix", + "-v", "/run/desktop/mnt/wslg:/mnt/wslg", + "-e", "DISPLAY=$DISPLAY", + "-e", "WAYLAND_DISPLAY=wayland-0", + "-e", "XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir" +) + +$dockerCommand += $ContainerName + " bash" + +docker @dockerCommand \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..395f0cc --- /dev/null +++ b/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ $# -ne 1 ]]; then + echo "using: $(basename $0) " + exit 1 +fi + +docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v $HOME/.Xauthority:/root/.Xauthority \ + -e DISPLAY=$DISPLAY \ + $1 bash +