Thanks to visit codestin.com
Credit goes to hub.docker.com

giof71/mopidy

By giof71

Updated 10 days ago

Run Mopidy on docker

Image
1

1.9K

giof71/mopidy repository overview

mopidy-docker

Run Mopidy in Docker

Description

I wanted to be able to play from Tidal to my audio devices (typically Raspberry Pi SBCs), directly from a browser, without using Tidal Connect, not available on any device/platform.
Mopidy along with the Mopidy-Tidal plugin offer a very nice interface, and represent a good response to this requirement.
Also, I like Mopidy to be able to connect to Jellyfin for music playback, as I am starting to explore this option.
I have only used it with alsa output, but I will probably add support for PulseAudio soon. Note that this is not terribly important to me, at least when using Tidal, which my main scenario. Using this application with PulseAudio would not offer any particular advantage compared to the Tidal Web Player.
The version included in the latest build is v0.3.13.

Support

ko-fi
Please see the Goal.
Please note that support goal is limited to cover running costs for subscriptions to music services.

References

PROJECTURL
MopidyMain site
mopidy-tidalGitHub repo
python-tidalGitHub repo
mopidy-jellyfinGitHub repo
mopidy-mobileGitHub repo

Repositories

Repo TypeLink
Source CodeGitHub
Docker ImagesDocker Hub

Contributors

Build

If, for any reason, you don't want or cannot use the images I publish to the Docker Hub Repository, you can build the image locally by switching to the root directory of the repository and issuing the following command:

./local-build.sh

Configuration

The configuration if driven by environment variables. You should not need to edit the configuration files directly.

Variables
VARIABLEDESCRIPTION
AUDIO_OUTPUTAudio output configuration
RESTORE_STATERestore last state on start, defaults to no
TIDAL_ENABLEDEnables the Tidal plugin, defaults to no
TIDAL_QUALITYSet quality for the Tidal plugin, defaults to LOSSLESS
TIDAL_LOGIN_METHODLogin method, can be BLOCK (default), AUTO or HACK
TIDAL_AUTH_METHODAuthentication method, can be OAUTH (default) or PKCE (legacy)
TIDAL_PLAYLIST_CACHE_REFRESH_SECSPlaylist content refresh time, defaults to 0
TIDAL_LOGIN_SERVER_PORTRequired for PKCE authentication, should not be mandatory for hires anymore.
TIDAL_LAZYLazy connection, true or false (default)
JELLYFIN_ENABLEDEnables the Jellyfin plugin, defaults to no
JELLYFIN_HOSTNAMEHostname for Jellyfin (mandatory)
JELLYFIN_USERNAMEUsername for Jellyfin
JELLYFIN_PASSWORDPassword for Jellyfin
JELLYFIN_USER_IDUser Id for Jellyfin
JELLYFIN_TOKENToken for Jellyfin
JELLYFIN_LIBRARIESLibraries for Jellyfin (optional, defaults to Music)
JELLYFIN_ALBUM_ARTIST_SORTOptional, defaults to false
JELLYFIN_ALBUM_FORMATOptional, will default to "{Name}"
JELLYFIN_MAX_BITRATEOptional, numeric
FILE_ENABLEDEnables the File plugin, defaults to no
LOCAL_ENABLEDEnables the Local plugin, defaults to no
LOCAL_MEDIA_DIRPath to local music directory, defaults to /music
LOCAL_MAX_SEARCH_RESULTSNumber of search results to return, defaults to 100
LOCAL_SCAN_TIMEOUTMilliseconds before giving up scanning a file
LOCAL_SCAN_FOLLOW_SYMLINKSWhether to follow symlinks, yes or no
LOCAL_SCAN_FLUSH_THRESHOLDNumber of tracks before flushing progress, 0 to disable
LOCAL_INCLUDED_FILE_EXTENSIONSFile extensions to include (comma separated, e.g. .flac,.mp3)
LOCAL_EXCLUDED_FILE_EXTENSIONSFile extensions to exclude (comma separated, e.g. .txt)
LOCAL_DIRECTORIESList of top-level directory names and URIs for browsing
LOCAL_TIMEOUTDatabase connection timeout in seconds
LOCAL_USE_ARTIST_SORTNAMEUse sortname field for ordering artist browse results, yes or no
LOCAL_ALBUM_ART_FILESList of file names to check for album art (comma or newline separated)
SCROBBLER_ENABLEDEnables the Scrobbler plugin, defaults to no
SCROBBLER_USERNAMELast.FM username
SCROBBLER_PASSWORDLast.FM password
MPD_ENABLEDEnables the MPD plugin, defaults to no
MOBILE_ENABLEDSet to yes to enable mobile UI
MOBILE_TITLEWeb application's title, defaults to Mopidy Mobile on $hostname
MOBILE_WS_URLWebSocket URL used to connect to your Mopidy server, set this when using a reverse proxy
USER_MODESet to yes to enable user mode
PUIDThe uid for USER_MODE, defaults to 1000
PGIDThe gid for USER_MODE, defaults to 1000
AUDIO_GIDGroup id for USER_MODE, set it to the group id of the group audio if USER_MODE is enabled
LOG_LEVEL0: quiet, 1: default, 2: verbose
Volumes
VOLUMEDESCRIPTION
/configConfiguration directory
/dataData directory
/cacheCache directory
/musicMusic directory

Examples

A simple docker-compose.yaml file.
Please note that this assumes your user of choice has uid 1000 and that the audio gid is 29.
The audio gid is generally 29 for debian base distros, including Moode Audio.
Also the selected audio output is the alsa device named D10 (matches the card name of a Topping D10).
The Tidal plugin is enabled with LOSSLESS quality.
Make sure you create the config, cache and data directories where you place this docker-compose.yaml file, and that those directories are writable for the user identified by the uid (1000 in the example) and gid (29 in the example) that you choose.

---
version: "3.3"

services:
  mopidy:
    image: giof71/mopidy
    container_name: mopidy
    user: "1000:29"
    devices:
      - /dev/snd:/dev/snd
    environment:
      - AUDIO_OUTPUT=alsasink device=hw:D10
      - RESTORE_STATE=yes
      - SCROBBLER_ENABLED=${SCROBBLER_ENABLED:-}
      - SCROBBLER_USERNAME=${SCROBBLER_USERNAME:-}
      - SCROBBLER_PASSWORD=${SCROBBLER_PASSWORD:-}
      - TIDAL_ENABLED=yes
      - TIDAL_QUALITY=${TIDAL_QUALITY:-LOSSLESS}
    ports:
      - 6680:6680
      - 8989:8989
    volumes:
      - ./config:/config
      - ./cache:/cache
      - ./data:/data
    restart: always

In order to correctly set the credentials for Tidal, the first run should be done with this command:

docker-compose run mopidy

Look at the displayed instructions. The log should present a line similar to the following:

mopidy-app | INFO     2024-11-17 11:37:31,306 [39:TidalBackend-7 (_actor_loop)] mopidy_tidal.backend
mopidy-app |   Please visit 'http://localhost:8989' or 'https://link.tidal.com/XXXXX' to authenticate

follow the second link, authenticate with Tidal (if necessary) and authorize the new device on Tidal.
If, for any reason, you want to use the PKCE authentication, use the first link and follow the instructions that will be presented.

You will need an active Tidal subscription, of course.
After this action, you can stop the container (CTRL-C), and then start it normally using:

docker-compose up -d

The application should be accessible at the host-ip at port 6680.

Change History

Change DataMajor Changes
2025-10-22Routine rebuild, so it includes latest tidalapi
2025-09-14Rebuild with version v0.3.11
2025-07-12Rebuild with version v0.3.10
2024-11-13Rebuild with version v0.3.9
2024-11-10Rebuild with version v0.3.8
2024-09-08Add support for the jellyfin plugin
2024-09-05Fixed user management
2024-09-05Switch to ubuntu noble
2024-05-22Enable user mode if PUID is set
2024-05-22Add support for user mode
2024-03-04Add configuration options
2024-03-03Add pkce support for Tidal plugin
2024-02-22Add support for the MPD plugin
2024-02-21Review build process
2024-02-21First working version

Tag summary

Content type

Image

Digest

sha256:a899c368b

Size

438.9 MB

Last updated

10 days ago

Requires Docker Desktop 4.37.1 or later.