Difference between revisions of "Docker"
(4 intermediate revisions by the same user not shown) | |||
Line 171: | Line 171: | ||
3. that's it restart the tvheadend docker. | 3. that's it restart the tvheadend docker. | ||
+ | |||
+ | == FAQ == | ||
+ | |||
+ | === Stick wird nicht im Docker angezeigt === | ||
+ | |||
+ | Er findet leider den Stick nicht per Docker, warum auch immer…im Verzeichnis ist er aber vorhanden. | ||
+ | [[File:lsusbdocker.png]] | ||
+ | |||
+ | ---- | ||
+ | |||
+ | 1. Die Pfade sollen nicht zwischen den Klammern stehen, diese sollen entfernt werden (<, >) | ||
+ | <pre> | ||
+ | -v /home/pi/tvheadend/data:/config | ||
+ | -v /home/pi/tvheadend/recordings:/config | ||
+ | </pre> | ||
+ | 2. Zur Sicherheit kein Space zwischen --device= /dev/bus/dvb | ||
+ | |||
+ | 3. ls /dev/dvb auf dem Host muss adapter1 usw . anzeigen. | ||
+ | |||
+ | Wurde der Treiber installiert, /config/opt/bin/mediaclient -e sollte den Tuner im Docker anzeigen. | ||
+ | https://sundtek.de/wiki/index.php?title=Docker#Inside_the_docker (so springt man in's Docker rein). |
Latest revision as of 11:04, 8 October 2024
Contents
Docker
External Documentation
- Synology Wiki (German):
https://www.synology-wiki.de/index.php/TvHeadend_mit_Docker_und_Sundtek_SkyTV_Ultimate
On the host
This is the step that has to be taken care about on the native host (outside of the docker image). The driver can run in non-privileged mode inside the docker. Various libc / musl / uclibc images are supported.
If you want to install the linux driver in a docker environment a few things need to be taken care of.
Device Nodes on the Host
Very important /dev/bus/usb contain the interface to the raw USB devices which is used by the sundtek driver. However one special (and a little bit messy part of docker) is that it also needs to know the major/minor IDs which are allowed to be forwarded - before creating and before starting the docker image, that's why nodes in /dev/dvb need to be pre-created on the host.
If you install the driver on the host you should create a configuration file which contains following text: enabledocker=on
this will cause that the driver on the native host (not in the docker) will create dummy adapter nodes in /dev/dvb, the driver itself will not try to access the USB device - it will only create the files if enabledocker=on is set in the configuration file and exit immediately.
On the host:
sudo -s echo "enabledocker=on" > /etc/sundtek.conf
You can also create them manually if you want (see next section):
Without installing the driver on the host
So the driver on the host has no special function it would just create /dev/dvb devicenodes and exist immediately. You can create those dummies manually (but those need to be there before creating the docker image and before starting the docker image)
mkdir -p /dev/dvb/adapter0 mknod /dev/dvb/adapter0/frontend0 c 212 1 mknod /dev/dvb/adapter0/dvr0 c 212 5 mknod /dev/dvb/adapter0/demux0 c 212 3 mkdir -p /dev/dvb/adapter1 mknod /dev/dvb/adapter1/frontend0 c 212 7 mknod /dev/dvb/adapter1/dvr0 c 212 11 mknod /dev/dvb/adapter1/demux0 c 212 9 mkdir -p /dev/dvb/adapter2 mknod /dev/dvb/adapter2/frontend0 c 212 13 mknod /dev/dvb/adapter2/dvr0 c 212 17 mknod /dev/dvb/adapter2/demux0 c 212 15
Synology NAS
You can install the driver on the host and check the option "Enable Docker" in the Configuration menu. When this is checked the driver will only create those dummy nodes on the host and exit immediately.
Creating a Docker Image
The docker itself needs to be created with some -device flags
Alpine Linux:
docker create --name alpinelinux --net=bridge -p 9981:9981 -p 9982:9982 --device=/dev/dvb --device=/dev/bus/usb -t alpine /bin/sh
Linuxserver / Tvheadend
docker create \ --name=tvheadend \ --net=bridge \ -v <path to data>:/config \ <- Pfad anpassen! / modify path (and remove the comment of course) -v <path to recordings>:/recordings \ <- Pfad anpassen! / modify path (and remove the comment of course) -p 9981:9981 \ -p 9982:9982 \ --device=/dev/dvb \ --device=/dev/bus/usb linuxserver/tvheadend
Inside the docker
Inside the docker unfortunately you only have one shot if you do it wrong you have to re-create the docker and re-do this step. Usually our customers install the drivers inside the docker in /config
To enter a docker image:
docker exec -it tvheadend /bin/sh
Download the netinstall script:
wget http://sundtek.de/media/sundtek_netinst.sh chmod 777 sundtek_netinst.sh ./sundtek_netinst.sh -docker -use-custom-path /config
The installer will rename the tvheadend binary in /usr/bin to tvheadend.bin and places a script instead which will automatically start the driver.
this will place the driver in /config
Usually you will want to mount a local directory inside the docker, this can basically be configured via the Synology Webfrontend. When doing that you need to take care that the user inside the docker also has access to that folder otherwise you will get a permission denied.
You can use the tvheadend start script to change the permissions if you need that, /usr/bin/tvheadend add chmod 777 /path/to/videodirectory
Misc
one customer also needed to modify the preset current limit of the tuner, he had to place lnblimit=1000ma (case sensitive in sundtek.conf inside the docker)
Unraid
All the sundtek devices work with Unraid. The installation is comfortably handled by a Sundtek Driver plugin in the Unraid environment. So just install the plugin and you're set.
--- the old documentation for unraid follows here, we just keep it here for the record ---
1. Set up the driver on the host system
Open a terminal as root (console) and run:
cd /tmp wget http://sundtek.de/media/sundtek_netinst.sh chmod 777 sundtek_netinst.sh ./sundtek_netinst.sh -dockerhost
(this will only take care that some dummy nodes are created in /dev/dvb/, access control will be handled by major/minor numbers of the existing files. When the driver is started on the host it will exit directly due to the dockerhost flag and only create the nodes)
basically all this does is
mkdir -p /dev/dvb/adapter0 mkdir -p /dev/dvb/adapter1 #crwxrwxrwx 1 root root 212, 1 Dec 19 20:44 frontend0 #crwxrwxrwx 1 root root 212, 5 Dec 19 20:44 dvr0 #crwxrwxrwx 1 root root 212, 3 Dec 19 20:44 demux0 mknod /dev/dvb/adapter0/frontend0 c 212 1 mknod /dev/dvb/adapter0/dvr0 c 212 5 mknod /dev/dvb/adapter0/demux0 c 212 3 #crwxrwxrwx 1 root root 212, 7 Dec 19 20:44 frontend0 #crwxrwxrwx 1 root root 212, 11 Dec 19 20:44 dvr0 #crwxrwxrwx 1 root root 212, 9 Dec 19 20:44 demux0 mknod /dev/dvb/adapter1/frontend0 c 212 7 mknod /dev/dvb/adapter1/dvr0 c 212 11 mknod /dev/dvb/adapter1/demux0 c 212 9
2. Set up the driver inside the tvheadend docker
... install the tvheadend docker, add an extra device driver for /dev/bus/usb
open the host terminal and enter the tvheadend docker image:
docker exec -it tvheadend /bin/sh cd /tmp wget http://sundtek.de/media/sundtek_netinst.sh chmod 777 sundtek_netinst.sh ./sundtek_netinst.sh -docker -use-custom-path /config
(this will rename the tvheadend binary to tvheadend.bin and put a script in between which will start the driver inside the docker - followed by the actual tvheadend binary).
3. that's it restart the tvheadend docker.
FAQ
Stick wird nicht im Docker angezeigt
Er findet leider den Stick nicht per Docker, warum auch immer…im Verzeichnis ist er aber vorhanden.
1. Die Pfade sollen nicht zwischen den Klammern stehen, diese sollen entfernt werden (<, >)
-v /home/pi/tvheadend/data:/config -v /home/pi/tvheadend/recordings:/config
2. Zur Sicherheit kein Space zwischen --device= /dev/bus/dvb
3. ls /dev/dvb auf dem Host muss adapter1 usw . anzeigen.
Wurde der Treiber installiert, /config/opt/bin/mediaclient -e sollte den Tuner im Docker anzeigen. https://sundtek.de/wiki/index.php?title=Docker#Inside_the_docker (so springt man in's Docker rein).