update containers and readme

This commit is contained in:
jb-alvarado 2024-04-10 14:34:46 +02:00
parent b21549aa84
commit 6dcbeb6e85
5 changed files with 26 additions and 14 deletions

View File

@ -23,7 +23,7 @@ RUN dnf update -y && \
dnf config-manager --set-enabled crb && \ 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/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 --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 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/ && \ 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 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"] CMD ["/usr/sbin/init"]

View File

@ -6,6 +6,12 @@
Use of [CentOS image](https://hub.docker.com/_/centos) as base image as it offer the possibility to use systemd. 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. 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 ## 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. 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`. 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 /!\ ### /!\ 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 # build ffmpeg from source
docker build -f fromSource.Dockerfile -t ffplayout-image:from-source . docker build -f fromSource.Dockerfile -t ffplayout-image:from-source .
# build with current almalinux image # build with nvidia image for hardware support
docker build -f Almalinux.Dockerfile -t ffplayout-image:almalinux . docker build -f nvidia-centos7.Dockerfile -t ffplayout-image:nvidia .
``` ```
example of command to start the container: example of command to start the container:
``` ```BASH
docker run -ti --name ffplayout -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN -p 8787:8787 ffplayout-image 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 #### 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 ## Kubernetes

View File

@ -5,9 +5,9 @@ services:
cap_add: cap_add:
- SYS_ADMIN - SYS_ADMIN
container_name: ffplayout container_name: ffplayout
privileged: true
build: build:
context: .
dockerfile: ./Dockerfile dockerfile: ./Dockerfile
ports: ports:
- '8787' - '8787:8787'
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup

View File

@ -160,6 +160,4 @@ RUN \
EXPOSE 8787 EXPOSE 8787
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"] CMD ["/usr/sbin/init"]

View File

@ -108,5 +108,5 @@ EXPOSE 8787
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/nvidia.conf 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 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"] CMD ["/usr/sbin/init"]