I'm currently trying to run a ffmpeg Docker image inside my own container with docker-compose using the depends_on clause. But when I try to reach ffmpeg inside my code, it seems like it's not available system-wide and I get an error. I believe I'm misconfiguring Docker.
My current Dockerfile is as follows:
FROM node:9
WORKDIR /usr/app
COPY package*.json ./
RUN npm install --quiet
COPY . .
And my docker-compose.yml:
version: '3'
services:
app:
build: .
command: npm run dev
volumes:
- .:/usr/app/
- /usr/app/node_modules
ports:
- "3000:3000"
depends_on:
- ffmpeg
ffmpeg:
image: jrottenberg/ffmpeg:3.3
When I run docker-compose up I can see that the ffmpeg is actually working, but then my application proceeds to start and it seems that ffmpeg ceases to work.
You are mixing two things linking or depend_on vs multi-stage image.
Linking or depend_on is used for docker container network communication not to access the application installed of the linked container.
when you link DB this means you can connect the database from your localhost (3306 in container)
So what I will suggest installing FFmpeg in your nodejs container.
Here is Dockerfile based on nodejs:alpine which is more lightweight then nodejs:9
FROM node:alpine
RUN apk add --no-cache ffmpeg
If you run the container or check in the container you will see its working fine.

Update:
You can pull the image from the Docker repository.
Node verification
docker run -it --rm adiii717/ffmpeg ash -c "node -v"
ffmpeg verification
docker run -it --rm adiii717/ffmpeg ash -c "ffmpeg -version"
ffmpeg docker repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With