Sign inSign up

01devmath/mopidy

By 01devmath

•Updated 3 months ago

Run Mopidy, an extensible music server inside a container.

Image
0

1.2K

01devmath/mopidy repository overview

⁠Mopidy Docker Image

! You can check the Dockerfile on the GitHub repository⁠.

Mopidy is a flexible music server that can play music from various sources, including local files, Spotify, SoundCloud, and more. It can be controlled remotely and supports various music player clients.

Mopidy Logo

⁠Table of Contents

⁠How to use this image

⁠Getting the image

Pull the Mopidy image you want from Docker Hub:

$ docker pull 01devmath/mopidy:latest
$ docker pull 01devmath/mopidy:youtube
⁠Example usage

Core image (minimal):

$ docker run -d --name mopidy-server \
    -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
    -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
    -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \
    -v ~/.config/mopidy:/mopidy/config \
    -p 127.0.0.1:6600:6600 \
    01devmath/mopidy:latest

YouTube-enabled image (addons baked in):

$ docker run -d --name mopidy-server \
    -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
    -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
    -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \
    -v ~/.config/mopidy:/mopidy/config \
    -p 127.0.0.1:6600:6600 \
    01devmath/mopidy:youtube

(Make sure to expose the ports used in your configuration file using the -p option in the docker run command.)

⁠Configuration

⁠Using a custom Mopidy configuration

By default, Mopidy will look for its configuration file in /mopidy/config inside the container. If you want to use a different configuration file or path, you can specify it using the --config flag (Read Mopidy docs⁠).

You can pass your configuration file or directory using a bind mount⁠.

For example, here I'm using the -v flag to access my host Mopidy configuration:

$ docker run \
	-v ~/.config/mopidy:/mopidy/config \
	# other argumments...
	01devmath/mopidy

You can find a Mopidy example configuration to use with this container in my dotfiles⁠.

⁠Mopidy addons

You can customize the Mopidy installation by specifying additional addons using the MOPIDY_ADDONS environment variable. The addons should be specified following the naming conventions used on PyPI for the respective packages. You can find a list of available Mopidy extensions on the Mopidy Extensions page⁠.

For example, to install the MPD addon on the core image, you can pass the addons with the -e flag, like this:

$ docker run \
	-e MOPIDY_ADDONS="Mopidy-MPD"
	# other argumments...
	01devmath/mopidy:latest

The 01devmath/mopidy:youtube tag already includes:

Mopidy-MPD Mopidy-YouTube ytmusicapi pytube yt-dlp[default]

It also includes deno and yt-dlp[default] (which pulls yt-dlp-ejs) to satisfy the JavaScript runtime requirement for yt-dlp signature and challenge solving.

Note: The Dockerfile includes a conditional patch for mopidy-youtube==4.0 to replace a deprecated Pydantic v2 argument (by_aliases -> by_alias). Remove this once an upstream release fixes the issue.

⁠Setting Up Sound in the Container

For information on setting up sound in Docker with Pulseaudio or ALSA, refer to Container sound: ALSA or Pulseaudio⁠.

Note:

  • In the 'Example usage'⁠ section, Pulseaudio is used with a shared socket, and my pulseaudio cookie is located in ~/.config/pulse/cookie. You may need to adjust this based on your setup.

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

sha256:475a8dd09…

Size

208.7 MB

Last updated

3 months ago

docker pull 01devmath/mopidy