Docker Nextcloud install ffmpeg

This article mainly solves the problem of installing ffmpeg and other dependencies in the Nextcloud which installed by docker, but not willing to write a new Dockerfile or use a third-party image.


docker run -p 80:80 --entrypoint /bin/sh nextcloud -c "apt-get update && apt-get install -y ffmpeg && / apache2-foreground"


By the following command:

docker image inspect nextcloud

We can see that the official image of Nextcloud is started by running / and giving a parameter "apache2-foreground"

Therefore, in order to install ffmpeg before Nextcloud starts, we only need to change the entrypoint to /bin/sh, then install the dependencies in CMD, and finally start the Nextcloud script.

Solution comparison:


Pros: No need to customize the image, it is more convenient for Nextcloud running in K8S. Every time you only need to directly pull the official image, you can ensure that your Nextcloud is the latest official version, and the dependencies will be installed automatically.

Cons: ffmpeg needs to be downloaded once every time. The startup speed is strongly dependent on the network speed.


Pros: Simple, quick and easy to operate. Through the code repository, Dockerfile can be used to implement version management of dependencies.

Cons: Every time you upgrade nextcloud, you need to rebuild image. And you need to have your own image repository (such as registering docker hub).

Third party image

Pros: Super easy.

Cons: The version update is not timely. Third-party mirrors may have security risks.

Give up ffmpeg

Pros: There is nothing difficult in the world, as long as you are willing to give up. I use ffmpeg to make preview of video, and final experience is just so so. 

Cons: You will lose a feature.

DigitalOcean Referral Badge 蜀ICP备19018968号