Reputation: 1252
I have a simple node.js app where I start playing a song from URL (using ffplay as a child process).
Locally everything works fine.
In Docker when I start playing, everything ok, no errors, but there is no sound on my laptop.
Is it possible to "expose" audio from docker to the host machine?
here is my dockerfile
FROM node:14.15.0-alpine
RUN apk add --no-cache ffmpeg
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY src/ src/
CMD ["npm", "run", "start:prod"]
I run this command
docker build . -t pig && docker run --rm --device /dev/snd --name pig pig
Upvotes: 1
Views: 344
Reputation: 10064
You need to use the device flag to share host's sound with the container:
docker run ... --device /dev/snd image-name
Upvotes: 1