Reputation: 433
I have a small dotnet client that runs videos using mplayer on Raspbian.
When logged in via SSH, I can run mplayer manually providing i set the DISPLAY variable to :0 and run mplayer as follows:
mplayer -vo gl video.mp4
This will display the video on the Raspberry Pi's screen when logged in remotely.
I am trying to create a docker image and deployment where I can do the same thing from a docker container.
The Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-arm64v8 AS build
WORKDIR /src
COPY ["presentationtv-client/PresentationTV.Client.csproj", "presentationtv-client/"]
RUN dotnet restore "presentationtv-client/PresentationTV.Client.csproj"
COPY . .
WORKDIR /src/presentationtv-client
RUN dotnet build "PresentationTV.Client.csproj" -c Release --no-restore
FROM build AS publish
WORKDIR /src/presentationtv-client
RUN dotnet publish "PresentationTV.Client.csproj" -c Release -o /app/publish --no-build
FROM mcr.microsoft.com/dotnet/aspnet:6.0.4-bullseye-slim-arm64v8 AS final
WORKDIR /
RUN \
apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install curl mplayer bash-completion
RUN mkdir -p /tvclient/runtime
RUN mkdir -p /tvclient/logs
RUN mkdir -p /tvclient/storage
ADD presentationtv-client/appsettings.json.linux /tvclient/appsettings.json
ADD presentationtv-client/appsettings.json.linux /tvclient/runtime/appsettings.json
ENV DISPLAY=:0
COPY --from=publish /app/publish/ /tvclient/runtime
#ENTRYPOINT ["dotnet", "/tvclient/runtime/PresentationTVClient.dll"]
ENTRYPOINT ["tail", "-f", "/dev/null"]
And my docker-compose :
version: "3.0"
services:
tvclient:
image: tvclient
container_name: tvclient
network_mode: "host"
environment:
- DISPLAY=:0
- UID=0
- GID=0
volumes:
- /etc/localtime:/etc/localtime:ro
- ./storage:/tvclient/storage
- ./logs:/tvclient/logs
devices:
- /dev/vchiq:/dev/vchiq # MMAL/OMX on Raspberry Pi
deploy:
resources:
limits:
cpus: '1.0'
restart: unless-stopped
When I exec into the container and run mplayer manually to test if it works I get the following error:
No protocol specified
vo: couldn't open the X11 display (:0)!
No protocol specified
No protocol specified
No protocol specified
My guess is I cannot interface with the X11 driver or there is no driver supported.
I am not really sure what I need to do to get it working. It needs to be with some form of acceleration else the full screen video is too slow (from my tests just running locally on the Pi).
Upvotes: 0
Views: 435