Install ffmpeg with docker-compose?

Hi,

i would like to try out the ipcamera binding, which needs ffmpeg to stream rtsps streams.
I already found a closed topic, how to add ffmpeg to the docker image, but i dont want to build my own image. Actually i am using the latest stable image with docker-compose.
Is there a way do get ffmpeg into it?

Thanks in advance,
Alex

There is no way to get anything installed in the container without modifying the container.

There are two ways to do this:

  1. build it into the image (the more correct approach)

  2. install it after the container is created and started

Building a new image is simple. In the docker file just base it on the official openHAB Image and add the necessary apt update and apt install ffmpeg commands to build the new image.

For option 2, you can just enter the container using docker exec -it openhab bash and run the apt commands manually. Of course you’ll have to redo this every time you change the container.

Alternatively you can mount a script that runs every time the container starts and have that run the apt commands. The down side of that is that it will run that every time the container starts, making it take longer for OH to come online. See the executing shell scripts before openHAB starts section of the docs on DockerHub.

FWIW I used the executing shell scripts option
Added to volume section of docker compose
- "/etc/cont-init.d:/etc/cont-init.d"
Added Script as 20-install-ffmpeg in directory

#!/bin/bash

if ! which ffmpeg >/dev/null; then
    echo "Installing ffmpeg"
    apt-get update
    apt-get install -y ffmpeg
else
    echo "ffmpeg is already installed"
fi

Thank you! Loading time really is a bit longer, but thats no problem in my case.