# Audio device in docker

**URL:** <https://discourse.mopidy.com/t/audio-device-in-docker/4587>\
**Category:** Help and support\
**Created:** [December 22, 2020, 9:23am UTC](https://discourse.mopidy.com/t/audio-device-in-docker/4587 "2020-12-22T09:23:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazkano](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/lazkano/32/1824_2.png) [@lazkano](https://discourse.mopidy.com/u/lazkano)\
**Post date:** [December 22, 2020, 9:23am UTC](https://discourse.mopidy.com/t/audio-device-in-docker/4587/1 "2020-12-22T09:23:04Z")

</div>

Hello,

I want to use Mopidy as a docker container, but I can not get audio output from any mopidy container I found:

> **[jjok/my-mopidy-setup](https://github.com/jjok/my-mopidy-setup)**
>
> Docker configurations to build my Mopidy setup. Contribute to jjok/my-mopidy-setup development by creating an account on GitHub.

> **[Docker Hub](https://hub.docker.com/r/rawdlite/mopidy)**

> **[Docker Hub](https://hub.docker.com/r/wernight/mopidy)**

> **[Docker Hub](https://hub.docker.com/r/ivdata/mopidy)**

This is my host audio device:

```
$ ls -lh /dev/snd/
total 0
drwxr-xr-x 2 root root 80 dic 7 15:35 by-path
crw-rw---- 1 root audio 116, 5 dic 7 15:35 controlC0
crw-rw---- 1 root audio 116, 9 dic 7 15:35 controlC1
crw-rw---- 1 root audio 116, 3 dic 7 15:35 pcmC0D0c
crw-rw---- 1 root audio 116, 2 dic 7 15:35 pcmC0D0p
crw-rw---- 1 root audio 116, 4 dic 7 15:35 pcmC0D1p
crw-rw---- 1 root audio 116, 6 dic 7 15:35 pcmC1D0p
crw-rw---- 1 root audio 116, 7 dic 7 15:35 pcmC1D1p
crw-rw---- 1 root audio 116, 8 dic 7 15:35 pcmC1D2p
crw-rw---- 1 root audio 116, 1 dic 7 23:41 seq
crw-rw---- 1 root audio 116, 33 dic 7 15:35 timer

# dmesg | grep bytcr
[6.748988] bytcr_rt5651 bytcr_rt5651: quirk IN2_MAP enabled
[6.748994] bytcr_rt5651 bytcr_rt5651: quirk realtek,jack-detect-source 1
[6.748997] bytcr_rt5651 bytcr_rt5651: quirk realtek,over-current-threshold-microamp 2000
[6.749000] bytcr_rt5651 bytcr_rt5651: quirk realtek,over-current-scale-factor 1
[6.749002] bytcr_rt5651 bytcr_rt5651: quirk MCLK_EN enabled
[6.753318] bytcr_rt5651 bytcr_rt5651: snd-soc-dummy-dai <-> media-cpu-dai mapping ok
[6.753397] bytcr_rt5651 bytcr_rt5651: snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok
[6.756230] bytcr_rt5651 bytcr_rt5651: rt5651-aif1 <-> ssp2-port mapping ok
[6.776957] input: bytcr-rt5651 Headset as /devices/pci0000:00/808622A8:00/bytcr_rt5651/sound/card0/input5

```

In the host I have not ALSA or PulseAudio because I don’t need it.

How could I make a simple audio test with a container?

I will really appreciate your help.

Kind regards.

---

<div class="post-metadata">

**Author:** ![sapristi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/sapristi/32/1364_2.png) [@sapristi](https://discourse.mopidy.com/u/sapristi)\
**Post date:** [December 22, 2020, 11:17am UTC](https://discourse.mopidy.com/t/audio-device-in-docker/4587/2 "2020-12-22T11:17:53Z")

</div>

You need to make the container aware of your sound card (from this discussion for example: [https://stackoverflow.com/questions/41083436/how-to-play-sound-in-a-docker-container](https://stackoverflow.com/questions/41083436/how-to-play-sound-in-a-docker-container)).  
Basically you have to add ` --device /dev/snd` to your docker `run` / `compose` parameters, where `/dev/snd` is your soundcard peripheral (I guess this part could change to `/dev/snd1` or something, especially if you have multiple soundcards).

You might also find some resources here : [https://github.com/mviereck/x11docker](https://github.com/mviereck/x11docker) , but it seems they mainly plug the container to an existing alsa/pulseaudio.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [June 22, 2021, 11:17pm UTC](https://discourse.mopidy.com/t/audio-device-in-docker/4587/3 "2021-06-22T23:17:59Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
