Install ffmpgeg within docker container - sudo password

Hi,
i run openhab in a docker container (image 4.0.1) within qnap container station and want to install ffmpeg as extension for the ipcamera binding.
I attached to the container and tried to install the package with: “sudo apt install ffmpeg”.
Afterwards i am asked for the password, I tried: “habopen” but this doesn’t work.
Does anyone know the password or is there a better solution, maybe running ffmpeg in a separate container?
thx in advance
Nick

Normally with docker you add all install commands to the Dockerfile and then rebuild the image, but not sure if this is possible on qnap?

It is also possible to execute a script to install it before openHAB is started as explained in the documentation.

Adding a /etc/cont-init.d/20-install-ffmpeg script like this might work:

#!/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
1 Like

I created a custom Dockerfile to add ffmpeg to the container. Version can be any version, I used 4.0.1.
Dockerfile:

FROM openhab/openhab:4.0.1
RUN apt-get update
RUN apt-get install ffmpeg -y
docker build -t openhab/openhab4-custom .

After the image is build you can use it with a docker-compose file.

Hey,
thanks for the quick responses. In the meantime i found a pretty simple solution within the qnap container station.


See pic, it is possible to execute commands within a running container. Simply execute the commands as above:

apt update 
apt install ffmpeg -y

But I also like the idea to create a customized image from Dockerfile.
However.
Kind regards
Nick

This was very informative as I am looking to transition from openhabian to docker on my Rpi4 and have the IP camera binding. I’m new to docker, so have to ask; Do I need to have Java installed on the bare metal or does this come with the docker package? The reason I ask is that I did install OH4 in docker on a RPI3 (as a test) and the java version on the OH UI page (Help and About) was different than the one I installed on the bare metal.

No need for installing Java on your Docker host. The container ships with everything to run openHAB including Java. Packages that take up a lot of space aren’t installed by default so it doesn’t take ages to download and install. :whale:

1 Like

Sorry to wander even further off topic but yeah, installing OH in a docker is stupid easy. I had OH4 running in a docker while still running OH3 to lend a hand with writing the docs when OH4 was pre-release

Edit to add: Thank you Wouter for maintaining our little corner of docker hub

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.