Docker Setup
Running Lavalink in Docker containers provides isolation, portability, and easy management. This is the recommended approach for experienced users and production deployments.Docker images are available on GitHub Container Registry. Older builds (prior to v3.7.4) are available on Docker Hub.
Prerequisites
Install Docker and Docker Compose
You need both Docker and Docker Compose installed on your system:Verify your installation:
Docker Image Variants
Lavalink provides three image variants to suit different needs:| Variant | Description | Java Version | User | Group | Image Tag Example |
|---|---|---|---|---|---|
| Ubuntu | Default variant, based on Ubuntu | 18 | 322 | 322 | ghcr.io/lavalink-devs/lavalink:4 |
| Alpine | Smaller image, based on Alpine | 17 | 322 | 322 | ghcr.io/lavalink-devs/lavalink:4-alpine |
| Distroless | Minimal image, based on Distroless | 17 | 65534 | 65534 | ghcr.io/lavalink-devs/lavalink:4-distroless |
The Alpine variant is recommended for most use cases due to its smaller size while maintaining full functionality.
Setup with Docker Compose
Configure Lavalink
You have two options for configuration:Option 1: Using application.yml (recommended)Create an
application.yml file in the same directory as compose.yml. See the Configuration File documentation for a complete example.Option 2: Using environment variablesUse environment variables in your compose.yml. See the Environment Variables documentation for examples.If you use environment variables, remove the
./application.yml volume mount from your compose.yml.Create plugins directory
Create a directory for plugins and set the correct permissions:
The user/group ID varies by image variant. Check the table above for the correct IDs.
Start Lavalink
Start your Lavalink container:The
-d flag runs the container in detached mode (in the background).Docker Networking
If your Discord bot also runs in a Docker container, you can connect both containers using Docker networking:Using Docker networking keeps traffic between containers internal and doesn’t require exposing ports to the host.
Managing Your Container
View logs
Restart Lavalink
Stop Lavalink
Update Lavalink
Remove the container
Memory Configuration
Adjust the Java heap size using the_JAVA_OPTIONS environment variable:
- Small bot (< 10 servers): 1GB - 2GB
- Medium bot (10-100 servers): 2GB - 4GB
- Large bot (100+ servers): 4GB - 8GB+
Advanced Configuration
Using a reverse proxy
If you’re using a reverse proxy like Nginx, ensure WebSocket support is properly configured:Custom Docker run command
If you prefer usingdocker run instead of Docker Compose:
Next Steps
Configuration
Learn how to configure sources, plugins, and advanced settings
Troubleshooting
Having issues? Check our troubleshooting guide
Plugins
Discover available plugins to extend functionality
Docker Networking
Learn more about Docker networking