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
- Reorganize README for a clearer flow and remove redundant database
setup instructions that were duplicating what the compose files show
- Add missing /var/www/html/public/img/storage volume to Dockerfile
- Document all three volumes in the README
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
[![docker-pulls-badge]][docker-hub]
5
5
6
-
A docker image with only the bare essentials needed to run [koel]. It includes Apache and a PHP runtime with required extensions.
6
+
A Docker image with only the bare essentials needed to run [Koel]. It includes Apache and a PHP runtime with required extensions.
7
7
8
8
> [!IMPORTANT]
9
-
> This container does not include a database. It **requires** another container to handle the database.
9
+
> This image does not include a database. A separate database container (MariaDB/MySQL or PostgreSQL) is required.
10
+
> Ready-to-use Docker Compose configurations are provided — see [Quick Start](#quick-start).
10
11
11
-
## Usage
12
+
## Quick Start
12
13
13
-
Since [Koel supports many databases][koel-requirements] you are free to choose any Docker image that hosts one of those databases.
14
-
15
-
`koel/docker` (this image) has been tested with MariaDB/MySQL and PostgreSQL.
16
-
17
-
### Run with docker-compose and MariaDB/MySQL
18
-
19
-
[docker-compose] is the easiest way to get started. It will start both the database container and this image.
20
-
Clone this repository and edit `docker-compose.mysql.yml`. **Make sure to replace passwords !**
21
-
22
-
Check out the [`./docker-compose.mysql.yml`](<./docker-compose.mysql.yml>) file for more details.
23
-
24
-
Then run `docker-compose`:
14
+
[Docker Compose][docker-compose] is the easiest way to get started. Clone this repository, pick a compose file for your preferred database, update the passwords, and run:
25
15
26
16
```bash
27
-
docker-compose -f ./docker-compose.mysql.yml up -d
28
-
```
29
-
30
-
### Run with docker-compose and PostgreSQL
31
-
32
-
Clone this repository and edit `docker-compose.postgres.yml`. **Make sure to replace passwords !**
17
+
# For MariaDB/MySQL
18
+
docker compose -f docker-compose.mysql.yml up -d
33
19
34
-
Check out the [`./docker-compose.postgres.yml`](<./docker-compose.postgres.yml>) file for more details.
35
-
36
-
Then run `docker-compose`:
37
-
38
-
```bash
39
-
docker-compose -f ./docker-compose.postgres.yml up -d
20
+
# For PostgreSQL
21
+
docker compose -f docker-compose.postgres.yml up -d
40
22
```
41
23
42
-
## The `koel:init` command
43
-
44
-
This command is automatically ran when the container starts, but can be disabled if you want to do some manual adjustments first. As such it is often sufficient to provide the needed env variables to the container to setup koel.
24
+
## Initial Setup
45
25
46
-
For the first installation and every subsequent upgrade, you will need to run the `koel:init` command, which handles migrations and other setup tasks.
47
-
For instance, during the first run, this command will generate the `APP_KEY`, create the default admin user, and initialize the database. For subsequent runs, it will apply any new migrations and update the database schema as needed.
26
+
### The `koel:init` command
48
27
49
-
In order to run this command, you first need to `exec` into the container (replace `<container_name_for_koel>` with the name of your running Koel container):
28
+
This command handles migrations, generates the `APP_KEY`, creates the default admin account, and performs other first-run tasks. It runs automatically when the container starts (disable with `SKIP_INIT=true`), but you can also run it manually:
The same applies for the first run. See the [First run section](#first-run).
53
+
### Preserving `APP_KEY`
120
54
121
-
### How to bind-mount the `.env` file
55
+
`APP_KEY` is generated during `koel:init` and is essential for encryption. If the container is recreated without persisting this key, you'll need to re-initialize. Two ways to preserve it:
122
56
123
-
To be sure to preserve `APP_KEY` you can choose to bind-mount the `.env` file to your host:
57
+
**Option 1: Bind-mount the `.env` file**
124
58
125
59
```bash
126
-
# On your host, create an `.env` file
127
60
touch .env
128
-
129
-
# Then, you can bind-mount it directly in the container
If you were running a version of Koel prior to v5.0.2, the search mechanism has changed and needs a step to index songs, albums and artists. Run the following command:
82
+
> [!IMPORTANT]
83
+
> This list is not exhaustive. See [`.env.example`][koel-env-example] for a complete reference.
84
+
85
+
| Variable | Description |
86
+
|---|---|
87
+
|`SKIP_INIT`| If set, prevents the container from running `koel:init` on startup. |
88
+
|`DB_CONNECTION`|`mysql`, `pgsql`, `sqlsrv`, or `sqlite-persistent`. |
89
+
|`DB_HOST`| Hostname of the database container. Must be on the same Docker network. |
For all new songs, the search index will be automatically populated by `php artisan koel:scan`. No need to run the `php artisan koel:search:import` again 🙂.
188
-
189
-
## Useful environment variables
190
-
191
-
> [!IMPORTANT]
192
-
> This list is not exhaustive and may not be up-to-date. See [`.env.example`][koel-env-example] for a complete reference.
193
-
194
-
-`SKIP_INIT`: Prevents the container from automatically running the init script on startup.
195
-
-`DB_CONNECTION`: `mysql` OR `pgsql` OR `sqlsrv` OR `sqlite-persistent`. Corresponds to the type of database being used with Koel.
196
-
-`DB_HOST`: `database`. The name of the Docker container hosting the database. Koel needs to be on the same Docker network to find the database by its name.
197
-
-`DB_USERNAME`: `koel`. If you change it, also change it in the database container.
198
-
-`DB_PASSWORD`: The password credential matching `DB_USERNAME`. If you change it, also change it in the database container.
199
-
-`DB_DATABASE`: `koel`. The database name for Koel. If you change it, also change it in the database container.
200
-
-`APP_KEY`: A base64-encoded string, generated by `php artisan koel:init` or by `php artisan key:generate`.
201
-
-`FORCE_HTTPS`: If set to `true`, all URLs redirects done by koel will use `https`. If you have set up a reverse-proxy in front of this container that supports `https`, set it to `true`.
202
-
-`MEMORY_LIMIT`: The amount of memory in MB for the scanning process. Increase this value if `php artisan koel:scan` runs out of memory.
203
-
-`LASTFM_API_KEY` and `LASTFM_API_SECRET`: Enables Last.fm integration. See https://docs.koel.dev/3rd-party.html#last-fm
204
-
-`SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`: Enables Spotify integration. See https://docs.koel.dev/3rd-party.html#spotify
205
-
-`OPTIMIZE_CONFIG` Preloads and optimizes koel's configuration. This disables config modifications while the container is running. If you enable this, every change to the configuration will require a container restart to be applied.
206
-
207
108
## Volumes
208
109
209
-
### /music
210
-
211
-
`/music` will contain the music library.
212
-
213
-
### /var/www/html/storage/search-indexes
214
-
215
-
`/var/www/html/storage/search-indexes` will contain the search indexes. Searching songs, albums and artists leverages this to provide results.
110
+
| Path | Description |
111
+
|---|---|
112
+
|`/music`| Your music library. |
113
+
|`/var/www/html/public/img/storage`| Uploaded images (album art, user avatars, etc.). |
114
+
|`/var/www/html/storage/search-indexes`| Search indexes for songs, albums, and artists. |
216
115
217
116
## Ports
218
117
219
-
### 80
220
-
221
-
Only HTTP is provided. Consider setting up a reverse-proxy to provide HTTPS support.
118
+
Only port **80** (HTTP) is exposed. Set up a reverse proxy for HTTPS support.
222
119
223
120
## Workdir
224
121
225
-
### /var/www/html
226
-
227
-
Apache's root directory. All koel files will be here. If you `exec` into the container, this will be your current directory.
122
+
The container's working directory is `/var/www/html` (Apache's document root). All Koel files reside here.
228
123
229
124
## Local Development
230
125
231
-
Inside `Makefile` you'll find several commands that can aid during the local development of koel/docker. For example, to build and start the `dev` docker-composer stack, run `make start`.
126
+
The `Makefile` contains several helper commands for local development. For example, to build and start the dev stack:
127
+
128
+
```bash
129
+
make start
130
+
```
232
131
233
132
## Help & Support
234
133
235
-
If you run into any issues, check the [Koel documentation][koel-doc] first.
134
+
If you run into any issues, check the [Koel documentation][koel-doc] first.
236
135
If you encounter a bug in Koel itself, open an issue in the [Koel repository][koel-repo].
237
-
This repo’s issues are reserved for Docker-related questions and problems.
136
+
This repo's issues are reserved for Docker-related questions and problems.
0 commit comments