This commit is contained in:
Artur Mukhamadiev 2025-10-07 20:35:19 +03:00
commit f4e1e1a4f4
5 changed files with 96 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -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"]

21
README.md Normal file
View File

@ -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)

8
build.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "using: $(basename $0) <container name>"
exit 1
fi
docker build -t $1 .

29
run.ps1 Normal file
View File

@ -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

13
run.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "using: $(basename $0) <container name>"
exit 1
fi
docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
-e DISPLAY=$DISPLAY \
$1 bash