Docker¶
Docker images can be found under packages with old builds prior to v3.7.4
being available on Docker Hub.
There are 2 image variants Ubuntu
and Alpine
, the Alpine
variant is smaller and can be used with the -alpine
suffix, for example ghcr.io/lavalink-devs/lavalink:3-alpine
.
Install Docker & Docker Compose
Create a docker-compose.yml
with the following content:
version: "3.8"
services:
lavalink:
# pin the image version to Lavalink v4
image: ghcr.io/lavalink-devs/lavalink:4
container_name: lavalink
restart: unless-stopped
environment:
# set Java options here
- _JAVA_OPTIONS=-Xmx6G
# set lavalink server port
- SERVER_PORT=2333
# set password for lavalink
- LAVALINK_SERVER_PASSWORD=youshallnotpass
volumes:
# mount application.yml from the same directory or use environment variables
- ./application.yml:/opt/Lavalink/application.yml
# persist plugins between restarts, make sure to set the correct permissions (user: 322, group: 322)
- ./plugins/:/opt/Lavalink/plugins/
networks:
- lavalink
expose:
# lavalink exposes port 2333 to connect to for other containers (this is for documentation purposes only)
- 2333
ports:
# you only need this if you want to make your lavalink accessible from outside of containers
- "2333:2333"
networks:
# create a lavalink network you can add other containers to, to give them access to Lavalink
lavalink:
name: lavalink
Create an application.yml
file in the same directory as the docker-compose.yml
file. (Example here) or use environment variables (Example here)
Run docker compose up -d
. See Docker Compose Up
If your bot also runs in a docker container you can make that container join the lavalink network and use lavalink
(service name) as the hostname to connect.
See Docker Networking & Docker Compose Networking