0

I would like to create a Docker container image that has FFMPEG and NodeJs installed. I am trying a multistage build Dockerfile as follows using the jrottenberg/ffmpeg and node:12 Docker images:

FROM jrottenberg/ffmpeg AS base

FROM node:12 as patch

ENTRYPOINT [ "node", "--version" ]

This container displays the node version correctly as v12.20.2 (as expected). However, if I change the ENTRYPOINT to ffmpeg, I get an error. The modified Dockerfile is as follows:

FROM jrottenberg/ffmpeg AS base

FROM node:12 as patch

ENTRYPOINT [ "ffmpeg", "-version" ]

The error is:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "ffmpeg": executable file not found in $PATH: unknown.

I intend to use a NodeJS program that would spawn FFMPEG as a child process within the container. How do I get this to work?

I have also tried using RUN apt-get install nodejs instruction in the Dockerfile instead of the FROM node:12. That also does not work.

vvg
  • 1,010
  • 7
  • 25
  • 1
    You can't use a multi-stage build to combine two images. After the second `FROM` line you've started over completely from scratch. A better approach would be to build an image `FROM node:buster` or another known Linux distribution base, then use the package manager to `apt-get install ffmpeg`. – David Maze Feb 19 '21 at 18:08

1 Answers1

-1

Update:

Incorporating feedback from @David Maze, the following dockerfile accomplished my original goal of NodeJs + FFMPEG on the image.

FROM node:alpine

RUN apk add ffmpeg

COPY ./app.js .

ENTRYPOINT node app.js

Although it is doesn't use a multistage build as I originally intended, it accomplished the purpose. The image size was also much smaller.

vvg
  • 1,010
  • 7
  • 25