Passing ALSA audio onto the host?

Hello there, this may sound like a basic question: how do I interface ALSA inside my container?

I read this from here but I’m not sure how I can execute a custom run command on BalenaOS:

docker run --rm --device /dev/snd

I’m trying to run SvxLinux on my Pi using BalenaOS. Essentially, it tries to use the speakers and doesn’t find them in the container and exits. Outside the container, I have an external USB sound card attached to my Pi 4 (64 bit OS).

Btw, SvxLinux can only use ALSA, OSS or UDP.

And for for reference, my code is here, and it’s based on this article.

Hi there,
to run the docker command you can connect via ssh form the dashboard or using the CLI, as described here: https://www.balena.io/docs/learn/manage/ssh-access/.
Once you are connected, just remember to replace docker with balena. Example balena run --rm --device /dev/snd ...

Thank you! I managed to do this with with a docker-compose file. :slight_smile:

Glad to hear it works @amingilani !

For whoever stumbles upon this in the future, here:

services:
  svxlink:
    build: ./svxlink
    devices:
      - "/dev/snd:/dev/snd"