You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+88-56
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,12 @@
1
1
[](http://microbadger.com/images/wernight/mopidy"Get your own image badge on microbadger.com")
2
2
3
-
Containerized [**Mopidy**](https://www.mopidy.com/) music server with support for [MPD clients](https://docs.mopidy.com/en/latest/clients/mpd/) and [HTTP clients](https://docs.mopidy.com/en/latest/ext/web/#ext-web).
3
+
What is Mopidy?
4
+
===============
4
5
6
+
[**Mopidy**](https://www.mopidy.com/) is a music server with support for [MPD clients](https://docs.mopidy.com/en/latest/clients/mpd/) and [HTTP clients](https://docs.mopidy.com/en/latest/ext/web/#ext-web).
5
7
6
-
### Features
8
+
Features of this image
9
+
----------------------
7
10
8
11
* Follows [official installation](https://docs.mopidy.com/en/latest/installation/debian/) on top of [Debian](https://registry.hub.docker.com/_/debian/).
9
12
* With backend extensions for:
@@ -17,19 +20,47 @@ Containerized [**Mopidy**](https://www.mopidy.com/) music server with support fo
17
20
You may install additional [backend extensions](https://docs.mopidy.com/en/latest/ext/backends/).
18
21
19
22
20
-
### Usage
23
+
Usage
24
+
-----
25
+
26
+
### Playing sound from the container
27
+
28
+
There are various ways to have the audio from Mopidy running in your container
29
+
to play on your system's audio output. Here are various ways, try them and find
30
+
which one works for you.
31
+
32
+
#### /dev/snd
33
+
34
+
Simplest is by adding docker argument: `--device /dev/snd`. Try via:
First to make [audio work from within a Docker container](http://stackoverflow.com/q/28985714/167897), you should enable [PulseAudio over network](https://wiki.freedesktop.org/www/Software/PulseAudio/Documentation/User/Network/); so if you have X11 you may for example do:
53
+
First to make [audio work from within a Docker container](http://stackoverflow.com/q/28985714/167897),
54
+
you should enable [PulseAudio over network](https://wiki.freedesktop.org/www/Software/PulseAudio/Documentation/User/Network/);
55
+
so if you have X11 you may for example do:
25
56
26
57
1. Install [PulseAudio Preferences](http://freedesktop.org/software/pulseaudio/paprefs/). Debian/Ubuntu users can do this:
27
58
28
59
$ sudo apt-get install paprefs
29
60
30
61
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).
31
62
32
-
3. Restart PulseAudio
63
+
3. Restart PulseAudio:
33
64
34
65
$ sudo service pulseaudio restart
35
66
@@ -38,82 +69,83 @@ First to make [audio work from within a Docker container](http://stackoverflow.c
38
69
$ pulseaudio -k
39
70
$ pulseaudio --start
40
71
41
-
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`.
72
+
Note: 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`.
See [mopidy's command](https://docs.mopidy.com/en/latest/command/) for possible additional options.
59
-
60
-
Most elements are optional (see some examples below). Replace `USERNAME`, `PASSWORD`, `TOKEN` accordingly if needed, or disable services (e.g., `-o spotify/enabled=false`):
61
-
62
-
* For *Spotify* you'll need a *Premium* account.
63
-
* For *Google Music* use your Google account (if you have *2-Step Authentication*, generate an [app specific password](https://security.google.com/settings/security/apppasswords)).
64
-
* For *SoundCloud*, just [get a token](https://www.mopidy.com/authenticate/) after registering.
65
-
66
-
Ports:
67
-
68
-
* 6600 - MPD server (if you use for example ncmpcpp client)
69
-
* 6680 - HTTP server (if you use your browser as client)
70
-
71
-
Environment variables:
74
+
Now set the environment variables:
72
75
73
76
*`PULSE_SERVER` - PulseAudio server socket.
74
77
*`PULSE_COOKIE_DATA` - Hexadecimal encoded PulseAudio cookie commonly at `~/.config/pulse/cookie`.
75
78
76
-
Volumes:
79
+
Example to check it works:
77
80
78
-
*`/var/lib/mopidy/media` - Path to directory with local media files (optional).
79
-
*`/var/lib/mopidy/local` - Path to directory to store local metadata such as libraries and playlists in (optional).
Most arguments are optional (see some examples below):
102
+
103
+
* Docker arguments:
104
+
* `$PUT_HERE_EXRA_DOCKER_ARGUMENTS_FOR_AUDIO_TO_WORK` should be replaced
105
+
with some arguments that work to play audio from within the docker
106
+
container as tested above.
107
+
* `-v ...:/var/lib/mopidy/media:ro` - (optional) Path to directory with local media files.
108
+
* `-v ...:/var/lib/mopidy/local` - (optional) Path to directory to store local metadata such as libraries and playlists in.
109
+
* `-p 6600:6600` - (optional) Exposes MPD server (if you use for example ncmpcpp client).
110
+
* `-p 6680:6680` - (optional) Exposes HTTP server (if you use your browser as client).
111
+
* `--user $UID:$GID` - (optional) You may run as any UID/GID, and by default it'll run as UID/GID `84044` (`mopidy:audio` from within the container).
112
+
The main restriction is if you want to read local media files: That the user (UID) you run as should have read access to these files.
113
+
Similar for other mounts. If you have issues, try first as `--user root`.
114
+
* Mopidy arguments (see [mopidy's command](https://docs.mopidy.com/en/latest/command/) for possible additional options),
115
+
replace `USERNAME`, `PASSWORD`, `TOKEN` accordingly if needed, or disable services (e.g., `-o spotify/enabled=false`):
116
+
* For *Spotify* you'll need a *Premium* account.
117
+
* For *Google Music* use your Google account (if you have *2-Step Authentication*, generate an [app specific password](https://security.google.com/settings/security/apppasswords)).
118
+
* For *SoundCloud*, just [get a token](https://www.mopidy.com/authenticate/) after registering.
85
119
86
120
##### Example using HTTP client to stream local files
87
121
88
122
1. Give read access to your audio files to user **84044**, group **84044**, or all users (e.g., `$ chgrp -R 84044 $PWD/media && chmod -R g+rX $PWD/media`).
0 commit comments