{"id":13677900,"url":"https://github.com/koel/docker","last_synced_at":"2025-04-07T06:08:11.415Z","repository":{"id":37987629,"uuid":"173583982","full_name":"koel/docker","owner":"koel","description":"A minimal docker image for the koel music streaming server.","archived":false,"fork":false,"pushed_at":"2024-09-08T11:59:09.000Z","size":205,"stargazers_count":182,"open_issues_count":27,"forks_count":54,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T00:55:16.649Z","etag":null,"topics":["docker","hacktoberfest","koel"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/phanan/koel/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-03T14:15:35.000Z","updated_at":"2024-10-27T16:40:41.000Z","dependencies_parsed_at":"2023-02-10T00:05:13.239Z","dependency_job_id":"434459ef-e6a3-490f-b139-a5f5269752e2","html_url":"https://github.com/koel/docker","commit_stats":{"total_commits":252,"total_committers":17,"mean_commits":"14.823529411764707","dds":0.6309523809523809,"last_synced_commit":"2a7372332b6b856b12073bd689bd3b37f7d0ba05"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koel%2Fdocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koel%2Fdocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koel%2Fdocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koel%2Fdocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koel","download_url":"https://codeload.github.com/koel/docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149499,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","hacktoberfest","koel"],"created_at":"2024-08-02T13:00:48.371Z","updated_at":"2025-04-07T06:08:11.393Z","avatar_url":"https://github.com/koel.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"koel/docker\n===========\n\n[![docker-pulls-badge]][docker-hub] ![Continuous testing and deployment](https://github.com/koel/docker/workflows/Continuous%20testing%20and%20deployment/badge.svg)\n\nA docker image with only the bare essentials needed to run [koel]. It includes\napache and a php runtime with required extensions.\n\nSee the [Changelog](\u003c./CHANGELOG.md\u003e) to keep track of changes to the image.\n\n## ⚠ Image changed to `phanan/koel` on 2022-04-15\n\nThis repository no longer updates `hyzual/koel`. The latest version is now at [phanan/koel:latest][docker-hub].\n\n## Usage\n\n\u003e **Warning**\n\u003e This container does not include a database. It **requires** another container to handle the database.\n\nSince [Koel supports many databases][koel-requirements] you are free to choose any Docker image that hosts one of those databases.\n\n`koel/docker` (this image) has been tested with MariaDB/MySQL and PostgreSQL.\n\n### Run with docker-compose and MariaDB/MySQL\n\n[docker-compose] is the easiest way to get started. It will start both the database container and this image.\nClone this repository and edit `docker-compose.mysql.yml`. **Make sure to replace passwords !**\n\nCheck out the [`./docker-compose.mysql.yml`](\u003c./docker-compose.mysql.yml\u003e) file for more details.\n\nThen run `docker-compose`:\n\n```bash\ndocker-compose -f ./docker-compose.mysql.yml up -d\n```\n\n### Run with docker-compose and PostgreSQL\n\nClone this repository and edit `docker-compose.postgres.yml`. **Make sure to replace passwords !**\n\nCheck out the [`./docker-compose.postgres.yml`](\u003c./docker-compose.postgres.yml\u003e) file for more details.\n\nThen run `docker-compose`:\n\n```bash\ndocker-compose -f ./docker-compose.postgres.yml up -d\n```\n\n### First run\n\nOn the first run, you will need to:\n\n1. Generate `APP_KEY`\n2. Create an admin user\n3. Initialize the database\n\nAll these steps are achieved by running `koel:init` once:\n\nReplace `\u003ccontainer_name_for_koel\u003e` in the command by the actual container name.\n\n```bash\ndocker exec --user www-data -it \u003ccontainer_name_for_koel\u003e bash\n# Once inside the container, you can run commands:\n$ php artisan koel:init --no-assets\n```\n\n`--no-assets` option tells the init command to skip building the front-end assets, as they have been generated by Koel's \"Release\" GitHub action.\n\n### Default admin account\n\n\u003e **Note**\n\u003e From v5.1.0, Koel no longer asks for a username, email and password for the admin account. Instead, it creates one automatically with the following credentials:\n\u003e email: `admin@koel.dev`\n\u003e password: `KoelIsCool`\n\n**Make sure to change this unsecure password** with the user interface (click on your profile picture) or by running the following command:\n\n```bash\ndocker exec -it \u003ccontainer_name_for_koel\u003e php artisan koel:admin:change-password\n```\n\n### Run manually with MariaDB/MySQL\n\nCreate a docker network. It will be shared by Koel and its database.\n\n```bash\ndocker network create --attachable koel-net\n```\n\nCreate a database container. Here we will use [mariadb].\n\n```bash\ndocker run -d --name database \\\n    -e MYSQL_ROOT_PASSWORD=\u003croot_password\u003e \\\n    -e MYSQL_DATABASE=koel \\\n    -e MYSQL_USER=koel \\\n    -e MYSQL_PASSWORD=\u003ckoel_password\u003e \\\n    --network=koel-net \\\n    -v koel_db:/var/lib/mysql \\\n    mariadb:10.11\n```\n\nCreate the koel container on the same network so they can communicate\n\n```bash\ndocker run -d --name koel \\\n    -p 80:80 \\\n    -e DB_CONNECTION=mysql \\\n    -e DB_HOST=database \\\n    -e DB_DATABASE=koel \\\n    -e DB_USERNAME=koel \\\n    -e DB_PASSWORD=\u003ckoel_password\u003e \\\n    --network=koel-net \\\n    -v music:/music \\\n    -v covers:/var/www/html/public/img/covers \\\n    -v search_index:/var/www/html/storage/search-indexes \\\n    phanan/koel\n```\n\nThe same applies for the first run. See the [First run section](#first-run).\n\n### How to bind-mount the `.env` file\n\nTo be sure to preserve `APP_KEY` you can choose to bind-mount the `.env` file to your host:\n\n```bash\n# On your host, create an `.env` file:\ntouch .env\n# Then, you can bind-mount it directly in the container.\ndocker run -d --name koel \\\n    -p 80:80 \\\n    --mount type=bind,source=\"$(pwd)\"/.env,target=/var/www/html/.env \\\n    phanan/koel\ndocker exec --user www-data -it koel bash\n# In the container, init\n$ php artisan koel:init --no-assets\n```\n\n### Pass environment variables\n\nOnce you have generated an `APP_KEY` you can provide it as environment variables to your container to preserve it.\n\n```bash\n# Run a container just to generate the key\ndocker run -it --rm phanan/koel bash\n# In the container, generate APP_KEY\n$ php artisan key:generate --force\n# Show the modified .env file\n$ cat .env\n# Copy the APP_KEY variable\n$ exit\n```\n\nYou can then provide the variables to your real container:\n\n```bash\ndocker run -d --name koel \\\n    -p 80:80 \\\n    -e APP_KEY=\u003cyour_app_key\u003e \\\n    phanan/koel\n# Even better, write an env-file in your host and pass it to the container\ndocker run -d --name koel \\\n    -p 80:80 \\\n    --env-file .koel.env \\\n    phanan/koel\n```\n\n### Scan media folders\n\nWhenever the music in `/music` changes, you will need to manually scan it before koel is able to play it. Run the following command:\n\n```bash\ndocker exec --user www-data \u003ccontainer_name_for_koel\u003e php artisan koel:sync\n```\n\n### Populate the search indexes\n\nIf 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:\n\n```bash\ndocker exec --user www-data \u003ccontainer_name_for_koel\u003e php artisan koel:search:import\n```\n\nFor all new songs, the search index will be automatically populated by `php artisan koel:sync`. No need to run the `php artisan koel:search:import` again 🙂.\n\n## Useful environment variables\n\n\u003e [!IMPORTANT]\n\u003e This list is not exhaustive and may not be up-to-date. See [`.env.example`][koel-env-example] for a complete reference.\n\n- `DB_CONNECTION`: `mysql` OR `pgsql` OR `sqlsrv` OR `sqlite-persistent`. Corresponds to the type of database being used with Koel.\n- `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.\n- `DB_USERNAME`: `koel`. If you change it, also change it in the database container.\n- `DB_PASSWORD`: The password credential matching `DB_USERNAME`. If you change it, also change it in the database container.\n- `DB_DATABASE`: `koel`. The database name for Koel. If you change it, also change it in the database container.\n- `APP_KEY`: A base64-encoded string, generated by `php artisan koel:init` or by `php artisan key:generate`.\n- `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`.\n- `MEMORY_LIMIT`: The amount of memory in MB for the scanning process. Increase this value if `php artisan koel:sync` runs out of memory.\n- `LASTFM_API_KEY` and `LASTFM_API_SECRET`: Enables Last.fm integration. See https://docs.koel.dev/3rd-party.html#last-fm\n- `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`: Enables Spotify integration. See https://docs.koel.dev/3rd-party.html#spotify\n\n## Volumes\n\n### /music\n\n`/music` will contain the music library. Keep in mind that koel needs to scan music before it's able to play it.\n\n### /var/www/html/storage/search-indexes\n\n`/var/www/html/storage/search-indexes` will contain the search indexes. Searching songs, albums and artists leverages this to provide results.\n\n## Ports\n\n### 80\n\nOnly HTTP is provided. Consider setting up a reverse-proxy to provide HTTPS support.\n\n## Workdir\n\n### /var/www/html\n\nApache's root directory. All koel files will be here. If you `exec` into the container, this will be your current directory.\n\n[koel-env-example]: https://github.com/koel/koel/blob/master/.env.example\n[koel-requirements]: https://koel.pages.dev/guide/getting-started#requirements\n[koel]: https://koel.dev/\n[mariadb]: https://hub.docker.com/r/mariadb/server\n[docker-compose]: https://docs.docker.com/compose/\n\n[docker-pulls-badge]: \u003chttps://img.shields.io/docker/pulls/phanan/koel\u003e\n[docker-hub]: https://hub.docker.com/r/phanan/koel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoel%2Fdocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoel%2Fdocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoel%2Fdocker/lists"}