Can't get sound and no streams working in a docker container

Dear all,
I am trying to convert my mopidy installation to a containerized one on the same hardware (where it was working just fine).

The mopidy.conf file was brought over from the working instance, and adjusted for the current setup, so mopidy picks up my library and playlists correctly.

Everything seems to work as expected except for 2 things:

  1. I cannot get sound at all. When I try to play any track, I get this in the logs:
mopidy  | AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
mopidy  | WARNING  2023-06-14 12:05:28,105 [8:MainThread] mopidy.audio.gst
mopidy  |   GStreamer warning: Failed to connect: Connection refused
  1. When I try playing my streams I get this in the logs:
mopidy  | Cannot connect to server socket err = No such file or directory
mopidy  | Cannot connect to server request channel
mopidy  | jack server is not running or cannot be started
mopidy  | JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
mopidy  | JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
mopidy  | AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
mopidy  | WARNING  2023-06-14 12:06:41,121 [8:MainThread] mopidy.audio.gst
mopidy  |   GStreamer warning: Failed to connect: Connection refused

Clearly, there is something wrong with the sound setup in both cases. Do I need to set something up on the host?

This is my docker-compose.yaml:

version: '3.3'
services:
    mopidy:
        container_name: mopidy
        user: root
        devices:
            - /dev/snd:/dev/snd
        volumes:
            - '/home/mc/mopidy/config:/config'
            - '/mnt/music:/var/lib/mopidy/media:ro'
            - '/home/mc/mopidy/m3u:/var/lib/mopidy/m3u'
            - '/home/mc/mopidy/local:/var/lib/mopidy/local'
        ports:
            - '6600:6600'
            - '6680:6680'
        image: 'jojo141185/mopidy:latest'

My effective configuration:

root@c1be6a7ee60a:/# mopidy config
[core]
cache_dir = $XDG_CACHE_DIR/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
color = true
config_file = 

[audio]
mixer = software
mixer_volume = 
output = autoaudiosink
buffer_time = 

[proxy]
scheme = 
hostname = 
port = 
username = 
password = 

[ytmusic]
enabled = false  ; Extension disabled by user config.

[youtube]
enabled = false  ; Extension disabled by user config.

[tunein]
enabled = false  ; Extension disabled by user config.

[soundcloud]
enabled = false  ; Extension disabled by user config.

[scrobbler]
enabled = false  ; Extension disabled by user config.

[podcast]
enabled = false  ; Extension disabled by user config.

[party]
enabled = false  ; Extension disabled by user config.

[musicbox_webclient]
enabled = true
musicbox = false
websocket_host = 
websocket_port = 
on_track_click = PLAY_ALL

[mpd]
enabled = true
hostname = ::
port = 6600
password = 
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist = 
  listall
  listallinfo
default_playlist_scheme = m3u

[local]
enabled = true
max_search_results = 100
media_dir = /var/lib/mopidy/local
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
included_file_extensions = 
excluded_file_extensions = 
  .cue
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
directories = 
  Albums                  local:directory?type=album
  Artists                 local:directory?type=artist
  Composers               local:directory?type=artist&role=composer
  Genres                  local:directory?type=genre
  Performers              local:directory?type=artist&role=performer
  Release Years           local:directory?type=date&format=%25Y
  Tracks                  local:directory?type=track
  Last Week's Updates     local:directory?max-age=604800
  Last Month's Updates    local:directory?max-age=2592000
timeout = 10
use_artist_sortname = false
album_art_files = 
  *.jpg
  *.jpeg
  *.png

[jellyfin]
enabled = false  ; Extension disabled by user config.

[dleyna]
enabled = false  ; Extension disabled by self check.

[iris]
enabled = false  ; Extension disabled by user config.

[spotify]
enabled = false  ; Extension disabled by user config.

[radionet]
enabled = false  ; Extension disabled by user config.

[file]
enabled = true
media_dirs = 
  /var/lib/mopidy/media|Music
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = 
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir = 
default_encoding = utf-8
default_extension = .m3u8
playlists_dir = /var/lib/mopidy/m3u

[softwaremixer]
enabled = true

[stream]
enabled = true
protocols = 
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist = 
timeout = 5000

These are my dependencies:

oot@c1be6a7ee60a:/# mopidy deps
Executable: /usr/local/bin/mopidy
Platform: Linux-6.1.0-9-amd64-x86_64-with-glibc2.31
Python: CPython 3.9.2 from /usr/lib/python3.9
Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
Mopidy-SoundCloud: 3.0.2 from /usr/local/lib/python3.9/dist-packages
  beautifulsoup4: 4.12.2 from /usr/local/lib/python3.9/dist-packages
    soupsieve: 2.4.1 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
Mopidy-Podcast: 3.0.1 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  uritools: 4.0.1 from /usr/local/lib/python3.9/dist-packages/uritools-4.0.1-py3.9.egg
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  cachetools: 5.3.1 from /usr/local/lib/python3.9/dist-packages
Mopidy-Spotify: 4.1.1 from /usr/local/lib/python3.9/dist-packages/Mopidy_Spotify-4.1.1-py3.9.egg
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
mopidy-ytmusic: 0.3.8 from /usr/local/lib/python3.9/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  ytmusicapi: 0.25.2 from /usr/local/lib/python3.9/dist-packages
    requests: 2.25.1 from /usr/lib/python3/dist-packages
  pytube: 12.1.3 from /usr/local/lib/python3.9/dist-packages
Mopidy-Iris: 3.67.0 from /iris
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-Party: 1.2.0 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-MusicBox-Webclient: 3.1.0 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-dLeyna: 2.0.2 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  uritools: 4.0.1 from /usr/local/lib/python3.9/dist-packages/uritools-4.0.1-py3.9.egg
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-RadioNet: 0.2.2 from /usr/local/lib/python3.9/dist-packages/Mopidy_RadioNet-0.2.2-py3.9.egg
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  uritools: 4.0.1 from /usr/local/lib/python3.9/dist-packages/uritools-4.0.1-py3.9.egg
Mopidy-YouTube: 3.7 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
  beautifulsoup4: 4.12.2 from /usr/local/lib/python3.9/dist-packages
    soupsieve: 2.4.1 from /usr/local/lib/python3.9/dist-packages
  cachetools: 5.3.1 from /usr/local/lib/python3.9/dist-packages
Mopidy-Scrobbler: 2.0.1 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  pylast: 5.2.0 from /usr/local/lib/python3.9/dist-packages
    httpx: 0.24.1 from /usr/local/lib/python3.9/dist-packages
      certifi: 2020.6.20 from /usr/lib/python3/dist-packages
      httpcore: 0.17.2 from /usr/local/lib/python3.9/dist-packages
        certifi: 2020.6.20 from /usr/lib/python3/dist-packages
        h11: 0.14.0 from /usr/local/lib/python3.9/dist-packages
        sniffio: 1.3.0 from /usr/local/lib/python3.9/dist-packages
        anyio: 3.7.0 from /usr/local/lib/python3.9/dist-packages
          idna: 2.10 from /usr/lib/python3/dist-packages
          exceptiongroup: 1.1.1 from /usr/local/lib/python3.9/dist-packages
          sniffio: 1.3.0 from /usr/local/lib/python3.9/dist-packages
      idna: 2.10 from /usr/lib/python3/dist-packages
      sniffio: 1.3.0 from /usr/local/lib/python3.9/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-Jellyfin: 1.0.4 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  websocket-client: 1.5.3 from /usr/local/lib/python3.9/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  unidecode: 1.3.6 from /usr/local/lib/python3.9/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
Mopidy-Local: 3.2.1 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  uritools: 4.0.1 from /usr/local/lib/python3.9/dist-packages/uritools-4.0.1-py3.9.egg
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-TuneIn: 1.1.0 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
Mopidy-MPD: 3.3.0 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  Mopidy: 3.4.1 from /usr/lib/python3/dist-packages
GStreamer: 1.18.4.0 from /usr/lib/python3/dist-packages/gi
  Detailed information: 
    Python wrapper: python-gi 3.38.0
    Relevant elements:
      Found:
        uridecodebin
        souphttpsrc
        appsrc
        alsasink
        osssink
        oss4sink
        pulsesink
        id3demux
        id3v2mux
        lamemp3enc
        mpegaudioparse
        mpg123audiodec
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        flump3dec
        mad

The host is a Debian GNU/Linux 12 (bookworm) x86_64 system, freshly installed.

Any idea what’s not correct? It’s been driving me crazy for 2 days…

Well, after some more investigation I found out, as I expected, that the host OS didn’t have the sound set up properly. I had to create a file /etc/modprobe.d/default.conf with the following content:

options snd_hda_intel index=1

reboot and all is good now!!!

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