30.9.19

Emby - enable hardware acceleration in container on Synology NAS (DS218+)

1) Create user, you are planning to use within container and ged it's UID

root@SynStorage:~/# id c-emby
uid=1032(c-emby) gid=100(users) groups=100(users),65538(docker),65537(video)

2) Get GID of "video" group (should be group owner of /dev/dri/* devices)

root@SynStorage:~/# ls -la /dev/dri
total 0
crw-rw----  1 root video 226,   0 Sep 26 11:54 card0
crw-rw----  1 root video 226,  64 Sep 26 11:54 controlD64
crw-rw----  1 root video 226, 128 Sep 26 11:54 renderD128

root@SynStorage:~/panelacek/conf-scripts/docker# grep video /etc/group
video:x:65537:root,docker,c-emby

3) Download container image and configure container with proper UUID / GUID and GIDLIST variables. One of GIDLIST needs to be GID of "video" group

UID=1032 //container user UID (c-emby)
GID=65538 //contaner group GID (docker)
GIDLIST=65538,65537 //docker,video

4) Map video devices to container

--device /dev/dri/card0:/dev/dri/card0 \
--device /dev/dri/controlD64:/dev/dri/controlD64 \
--device /dev/dri/renderD128:/dev/dri/renderD128 \

whole emby-docker-server.sh script (downloads and refresh emby server)w:

#!bin/sh
NAME="embyserver"
IMAGE="emby/embyserver:latest"
docker pull ${IMAGE}
docker stop ${NAME}
docker rm ${NAME}
docker run -d \
--name=${NAME} \
-e UID=1032 \
-e GID=65538 \
-e GIDLIST=100,65538,65537 \
-e TZ=Europe/Prague \
-p 32775:8096 \
-p 32768:8920 \
--privileged \
--device /dev/dri/card0:/dev/dri/card0 \
--device /dev/dri/controlD64:/dev/dri/controlD64 \
--device /dev/dri/renderD128:/dev/dri/renderD128 \
-v /volume1/docker/Emby:/config:rw \
-v /volume1/Movies:/movies:rw \
--restart unless-stopped \
--memory=4g \
--cpu-shares=90 \
${IMAGE}