spigot-docker/README.md

53 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2024-09-12 20:36:17 +02:00
# Spigot Docker
Run SpigotMC Server within Docker Container
## Setup Instructions
**Docker Run** (not recommended):
```console
$ docker run -d --name "spigot" --stop-timeout 60 -e AGREE_MINECRAFT_EULA=yes -e MC_VERSION=latest -v ./data:/opt/spigot-data -p 25565:25565 drmaxnix/spigot
```
**Docker Compose** (recommended):
```yaml
services:
main:
image: drmaxnix/spigot
restart: unless-stopped
stop_grace_period: 60s
environment:
AGREE_MINECRAFT_EULA: true
MC_VERSION: "latest"
volumes:
- ./data:/opt/spigot-data
ports:
- "25565:25565"
```
```console
$ docker compose up -d
```
> [!IMPORTANT]
> Make sure to keep the `--stop-timeout` or `stop_grace_period` option! When stopping, docker will kill the container after 10s; spigot often needs more time than that to save its worlds. Killing it while saving could lead to data loss!
> [!TIP]
> For both variants, persistent config and data files will be stored in the `./data` directory. Feel free to change this to your needs.
## Run Server Commands
Give yourself OP permissions:
```console
$ docker compose exec main cmd op YourUsernameHere
```
> [!NOTE]
> If you are using docker run, replace `docker compose exec main` with `docker exec -it spigot`.
## Disable Automatic Updates
By default, the container will check for updates when starting. If a new spigot server version is available, it will be built and then used instead of the old one. This behavior can be disabled using `AUTO_UPDATE=no`.<br />
With automatic updates disabled, the server will only be rebuilt if you delete the jar file (or files in `.build-meta`) or when changing the Minecraft Version (`MC_VERSION`).