Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create sound devices for debian in docker?

I'm using various docker containers which, under the covers are built on Debian sid. These images lack /dev/snd and /dev/snd/seq, which pretty much makes sense since they have no hardware audio card.

Several pieces of software I'm using to generate MIDI files require these sequencer devices to be present. They're not necessarily used to send out audio, but the code itself dies in init if the sound devices do not exist. To be clear, I don't need to generate an audio signal within docker, rather I just need these to exist to make other software happy.

So far, what I've tried is endlessly installing various alsa packages (alsa-utils, alsa-oss, and others) and trying to modprobe my way out of this, all with no luck.

Within a docker container, what needs to happen to have valid audio devices even if dummy?

like image 747
FrobberOfBits Avatar asked Sep 13 '17 23:09

FrobberOfBits


1 Answers

I've had success getting sound through Docker (not the same problem, I know) by adding the devices whe running the container.

docker run -it --device /dev/snd myimage

The permissions can get challenging very quickly, you might want to try initially using --device /dev/snd along with --privileged and then dial back privileges little by little once it works.

like image 152
rexypoo Avatar answered Nov 20 '22 01:11

rexypoo