Lavalink is a standalone Java audio server that your bot delegates all audio decoding and streaming work to. Rather than processing audio inside the Python process, the bot sends playback instructions over HTTP to Lavalink, which handles the heavy lifting independently. Docker is the recommended way to run Lavalink — you get a fully reproducible environment without installing Java, managing versions, or touching system dependencies on your host machine.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DJERLO/Simple-Discord-Music-Bot-Using-Nextcord/llms.txt
Use this file to discover all available pages before exploring further.
Local FFmpeg is not required. Lavalink handles all audio decoding and processing internally inside its own container.
docker-compose.yml
The project ships with a ready-madedocker-compose.yml that pulls the official Lavalink 4.x image and wires up everything the bot expects.
docker-compose.yml
| Field | Value | Purpose |
|---|---|---|
image | ghcr.io/lavalink-devs/lavalink:4.2.2 | Pinned stable release |
container_name | lavalink_node | Friendly name for docker CLI commands |
restart | unless-stopped | Auto-restarts on crash; stops only on explicit docker stop |
ports | 2333:2333 | Exposes Lavalink’s HTTP API to the host |
_JAVA_OPTIONS | -Xmx512M | Caps JVM heap at 512 MB |
application.yml
The volume mount injectsapplication.yml into the container at /opt/Lavalink/application.yml. This file controls Lavalink’s server port, authentication password, enabled audio sources, and logging output.
application.yml
- YouTube plugin (
dev.lavalink.youtube:youtube-plugin:1.18.1) — the official plugin replaces the built-in YouTube source;allowSearch,allowDirectVideoIds, andallowDirectPlaylistIdsare all enabled. - SoundCloud (
soundcloud: true,scSearch: true) — enables SoundCloud playback and search. - HTTP source (
http: true) — allows Lavalink to stream direct audio URLs such as.mp3files. bufferDurationMs: 400— sets the audio buffer to 400 ms for smooth playback.- Logging — Lavalink writes
INFO-level logs to./logs/lavalink.loginside the container.
Starting Lavalink
Verify Docker is running
Open a terminal and confirm the Docker daemon is active:If Docker is not running, start Docker Desktop (macOS/Windows) or run
sudo systemctl start docker (Linux).Start Lavalink in the background
From the project root (the directory containing The
docker-compose.yml), run:-d flag runs the container detached so it continues in the background after you close the terminal.Verify Lavalink is running
Open Lavalink returns a short HTML or JSON response when it is online. Any response on port 2333 confirms it is healthy.
http://localhost:2333 in a browser or use curl:Stopping Lavalink
To stop and remove the container:application.yml and the logs/ directory on the host.
Common Issues
Port 2333 is already in use
Port 2333 is already in use
Another process is bound to port 2333. Find and stop it, or change the host-side port in If you change the port, update
docker-compose.yml:bot.py’s on_ready handler to match the new URI (http://127.0.0.1:2334).Docker is not running
Docker is not running
docker-compose up will exit immediately with a connection error if the Docker daemon is not active. Start Docker and retry.Container exits immediately
Container exits immediately
Run
docker-compose logs lavalink to read the startup output. A malformed application.yml (incorrect indentation, wrong password format) is the most common cause of an instant exit.