How to install ffmpeg on n8n with docker

Guys, how should I set up my n8n Docker stack to run ffmpeg?

I tried the NODE_FUNCTION_ALLOW_EXTERNAL variable, but it didn’t work.

$ docker exec -it --user root n8n /bin/sh
/home/node # apk update
/home/node # apk add ffmpeg
<...many lines...>
OK: 156 MiB in 159 packages
/home/node #

then

Hey @jabbson

How do I use docker swarm, do I need to add no command?

image

Wait, what? :slight_smile:
Why do you need to use a docker swarm? How is it related to installing ffmpeg? If this is an unrelated question, please mark the answer as solution and create a new topic for the new question.

I use Docker Swarm in an infrastructure with 3 VPSs, where we distribute services among workers, webhooks + mcp, and editors.

I did it like this and it worked.

docker exec -it --user root <container_name> sh
apk update && apk add ffmpeg

But if you need to restart the container, you have to run it again. I’d like something to make it already in the Docker Swarm image.

If you need to integrate this binary into the image, you will have to build a custom image.

Dockerfile:

FROM n8nio/n8n:latest
USER root
RUN apk add --update ffmpeg
USER node

Build:

$ docker build -t n8n-ffmpeg .

then change n8nio/n8n:latest to n8n-ffmpeg:latest in your service configuration.