- Scripts and configs to run a Spigot Minecraft server in a Docker container
- Uses Ping Shutdown to gracefully stop the server on container stop
- This was written for my personal setup, your mileage may vary
- Run
docker compose buildto build the container - Run
docker compose upto start the container - Run
docker compose stopordocker compose downto stop the container - Run
docker compose attach minecraftto attach to the server's command prompt - The container uses the
unless-stoppedrestart policy
- The volumes can be managed as a project, see Projects
- Within the container, several mountpoints exist:
data/: Generic persistent data, designed for worlds and the server icon- Worlds and the icon use this by default, but it can be used for arbitrary data
config/: Configuration files for the server, seeDockerfilefor the symlinks pointing hereplugins/: Plugins and their configs, comes withPingShutdownto handle container stops gracefullylogs/: Logs and crash reports for the server
- The persistent data (log, plugins, configs, etc) is stored in several volumes
- These are grouped into a project
- Use
./create-project.sh [NAME]to create the directory structure for a new project - Use
--project-name [NAME]with the Docker commands to switch to a different project - Projects can be used to quickly swap to a different server configuration
compose.yamldefines several build arguments and environment variables- Build arguments:
JAVA_VERSION- The version of major Java to use in the container- Must be a valid eclipse-temurin container
SPIGOT_VERSION- The version of Minecraft to build Spigot forEULA:[true (default) / false]- Accept / reject the EULAUSER_UID- The UID of the user inside the container, defaults to1000- Will be used as the user ID for the volumes too
USER_GID- The GID of the user inside the container, defaults to1000- Will be used as the group ID for the volumes too
- Environment variables:
MINRAM- Minimum amount of RAM to allocate for the JVM, defaults to2GMAXRAM- Maximum amount of RAM to allocate for the JVM, defaults to16GSHUTDOWN_PORT:[1 - 65535]- The port to use forPingShutdown, defaults to20563PingShutdown's config must be changed to match, found inprojects/[NAME]/plugins/PingShutdown/config.yml
WORLD_PATH- Path relative to the server to store the worlds in, defaults todata
Warning
SHUTDOWN_PORT should be internal to container, otherwise anyone can ping the port to restart the server
- Use
BACKUP_NAMEandVERSIONinbackup-configto configure the backup's name - Run
./backup.sh [DESTINATION]to backupprojects/- If
DESTINATIONisn't specified or doesn't exist, the repository's directory will be used instead
- If
- Backups use
tarandpbzip2