Public | Automated Build

Last pushed: 5 days ago
Short Description
Containerized Mopidy with every official plugin as well as popular extras.
Full Description

Containerized Mopidy music server with support for MPD clients and HTTP clients.

Originally a fork of https://github.com/wernight/docker-mopidy, but has been highly modified since.

Features

You may install additional backends or frontends.

Usage

PulseAudio over network

First to make audio from from within a Docker container, you should enable PulseAudio over network; so if you have X11 you may for example do:

  1. Install PulseAudio Preferences. Debian/Ubuntu users can do this:

    $ sudo apt-get install paprefs
    
  2. Launch paprefs (PulseAudio Preferences) > "Network Server" tab > Check "Enable network access to local sound devices" (you may check "Don't require authentication" to avoid mounting cookie file described below).

  3. Restart PulseAudio

    $ sudo service pulseaudio restart
    

    or

    $ pulseaudio -k
    $ pulseaudio --start
    

    On some distributions, it may be necessary to completely restart your computer. You can confirm that the settings have successfully been applied running pax11publish | grep -Eo 'tcp:[^ ]*'. You should see something like tcp:myhostname:4713.

General usage

A script is provided to easily start a container using the latest image against your local pulseaudio daemon: run.
It's also stored in the image for easy access.

Use it like so, all options are optional, although the more you provide the more functionality you'll have.

docker run --rm trevorj/mopidy-extras host run \
      -o spotify/username='BLAH' -o spotify/password='BLAH' \
      -o gmusic/username='BLAH' -o gmusic/password='BLAH' \
      -o spotify_web/client_id='BLAH' -o spotify_web/client_secret='BLAH' \
      -o scrobbler/username='BLAH' -o scrobbler/password='BLAH' \
      -o audioaddict/username='BLAH' -o audioaddict/password='BLAH' \
      -o soundcloud/auth_token='BLAH' \
      | bash

You can also use docker-compose using the provided docker-compose.yml file. This works by forwarding your local
PulseAudio configuration into the container as a volume instead of passing in the cookie as an environment variable.

# in repo
docker-compose run --service-ports mopidy \
      -o spotify/username='BLAH' -o spotify/password='BLAH' \
      -o gmusic/username='BLAH' -o gmusic/password='BLAH' \
      -o spotify_web/client_id='BLAH' -o spotify_web/client_secret='BLAH' \
      -o scrobbler/username='BLAH' -o scrobbler/password='BLAH' \
      -o audioaddict/username='BLAH' -o audioaddict/password='BLAH' \
      -o soundcloud/auth_token='BLAH'

See mopidy's command for possible additional options.

Most elements are optional (see some examples below). Replace BLAH' accordingly if needed, or disable services (e.g.,-o spotify/enabled=false`):

  • For Spotify you'll need a Premium account.
  • For Google Music use your Google account (if you have 2-Step Authentication, generate an app specific password).
  • For SoundCloud, just get a token after registering.
  • For AudioAddict, you need a premium account if you want to set the quality past 64k, otherwise account is optional.

Ports:

  • 6600 - MPD server (if you use for example ncmpcpp client)
  • 6680 - HTTP server (if you use your browser as client)

Environment variables:

  • PULSE_SERVER - PulseAudio server socket.
  • PULSE_COOKIE_DATA - Hexadecimal encoded PulseAudio cookie commonly at ~/.config/pulse/cookie.

Volumes:

  • /app/Music ($XDG_MUSIC_DIR) - Path to directory with local media files (optional).
  • /app/.local/share/mopidy ($XDG_DATA_HOME/mopidy) - Path to directory to store local metadata such as libraries and playlists in (optional).
Example using HTTP client to stream local files
  1. Give read access to your audio files to user 1000 (app ala $APP_USER), group 1000 (app) or 29 (audio), or even all users (e.g., $ chgrp -R 29 $PWD/media && chmod -R g+r $PWD/media).

    • Work is currently being done to provide a more dynamic permission allocation.
  2. Index local files:

    $ docker run --rm trevorj/mopidy-extras host run mopidy local scan | bash
    
  3. Start the server:

docker run --rm trevorj/mopidy-extras host run \
      -o spotify/username='BLAH' -o spotify/password='BLAH' \
      -o gmusic/username='BLAH' -o gmusic/password='BLAH' \
      -o spotify_web/client_id='BLAH' -o spotify_web/client_secret='BLAH' \
      -o scrobbler/username='BLAH' -o scrobbler/password='BLAH' \
      -o audioaddict/username='BLAH' -o audioaddict/password='BLAH' \
      -o soundcloud/auth_token='BLAH' \
      | bash
  1. Browse to http://$HOST:6680/

     $ xdg-open http://$HOST:6680
    

Example using ncmpcpp MPD console client

Start the server using the commands above, then run ncmpcpp any usual way, ala:

$ docker run --rm -it wernight/ncmpcpp ncmpcpp --host "$HOST"

Feedbacks

Having more issues? Report a bug on GitHub. Also if you need some additional extensions/plugins that aren't already installed (please explain why).

Docker Pull Command
Owner
trevorj

Comments (0)