From 6dcbeb6e856e9f6669770182f2ce86fe27f83041 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Wed, 10 Apr 2024 14:34:46 +0200 Subject: [PATCH] update containers and readme --- docker/Dockerfile | 6 ++++-- docker/README.md | 24 ++++++++++++++++++------ docker/docker-compose.yml | 6 +++--- docker/fromSource.Dockerfile | 2 -- docker/nvidia-centos7.Dockerfile | 2 +- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 361f5f7a..e43ee164 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -23,7 +23,7 @@ RUN dnf update -y && \ dnf config-manager --set-enabled crb && \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \ - dnf install -y ffmpeg ffmpeg-devel wget dejavu-sans-fonts sudo && \ + dnf install -y ffmpeg wget dejavu-sans-fonts sudo && \ dnf clean all RUN [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" -P /tmp/ && \ @@ -38,6 +38,8 @@ RUN [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https: EXPOSE 8787 -VOLUME [ "/sys/fs/cgroup" ] +# Maybe on some systems is needed, combined with run parameters: --tmpfs /tmp --tmpfs /run --tmpfs /run/lock +# More infos: https://serverfault.com/a/1087467/387878 +#VOLUME [ "/tmp", "/run", "/run/lock" ] CMD ["/usr/sbin/init"] diff --git a/docker/README.md b/docker/README.md index 467d2aad..90be9e3f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,6 +6,12 @@ Use of [CentOS image](https://hub.docker.com/_/centos) as base image as it offer the possibility to use systemd. In order to run systemd in a container it has to run in privileged mode and bind to the `cgroup` of the host. +> **_NOTE:_** A system with CGroup V2 is need! +> Currently tested host systems are: +> - debian 12 with official docker ce from docker.com +> - Manjaro from 2024 Kernel 6.6+ +> - fedora 39 with podman + ## Image In addition to the base image, there is the compilation of ffmpeg and all lib from source based on https://github.com/jrottenberg/ffmpeg. @@ -13,7 +19,7 @@ We can't use directly the image from `jrottenberg/ffmpeg` as it compile ffmpeg w The image is build with a default user/pass `admin/admin`. -You can take a look à the [Dockerfile](Dockerfile) +You can take a look at the [Dockerfile](Dockerfile) ### /!\ as ffmpeg is compiled with `--enable-nonfree` don't push it to a public registry nor distribute the image /!\ @@ -40,18 +46,24 @@ docker build -f docker/Dockerfile -t ffplayout-image:alma . # build ffmpeg from source docker build -f fromSource.Dockerfile -t ffplayout-image:from-source . -# build with current almalinux image -docker build -f Almalinux.Dockerfile -t ffplayout-image:almalinux . +# build with nvidia image for hardware support +docker build -f nvidia-centos7.Dockerfile -t ffplayout-image:nvidia . ``` example of command to start the container: -``` -docker run -ti --name ffplayout -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN -p 8787:8787 ffplayout-image +```BASH +docker run -it --name ffplayout --privileged -p 8787:8787 ffplayout-image + +# run in daemon mode +docker run -d --name ffplayout --privileged -p 8787:8787 ffplayout-image + +# run with docker-compose +docker-compose up -d ``` #### Note from CentOS docker hub page -There have been reports that if you're using an Ubuntu host, you will need to add `-v /tmp/$(mktemp -d):/run` in addition to the cgroups mount. +There have been reports that if you're using an Ubuntu host, you will need to add `-v /tmp/$(mktemp -d):/run` to the mount. ## Kubernetes diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7426d483..608b4c15 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -5,9 +5,9 @@ services: cap_add: - SYS_ADMIN container_name: ffplayout + privileged: true build: + context: . dockerfile: ./Dockerfile ports: - - '8787' - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup \ No newline at end of file + - '8787:8787' diff --git a/docker/fromSource.Dockerfile b/docker/fromSource.Dockerfile index 15dfeb37..0a24f7d3 100644 --- a/docker/fromSource.Dockerfile +++ b/docker/fromSource.Dockerfile @@ -160,6 +160,4 @@ RUN \ EXPOSE 8787 -VOLUME [ "/sys/fs/cgroup" ] - CMD ["/usr/sbin/init"] diff --git a/docker/nvidia-centos7.Dockerfile b/docker/nvidia-centos7.Dockerfile index 5448e4c5..bc1d7967 100644 --- a/docker/nvidia-centos7.Dockerfile +++ b/docker/nvidia-centos7.Dockerfile @@ -108,5 +108,5 @@ EXPOSE 8787 RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/nvidia.conf RUN echo "/usr/local/cuda/compat/" >> /etc/ld.so.conf.d/nvidia.conf -VOLUME [ "/sys/fs/cgroup", "/tmp", "/run", "/run/lock", "/etc/ffplayout", "/usr/share/ffplayout" ,"/var/lib/ffplayout" ] +VOLUME [ "/tmp", "/run", "/run/lock", "/etc/ffplayout", "/usr/share/ffplayout" ,"/var/lib/ffplayout" ] CMD ["/usr/sbin/init"]