Update 2020-November-12

I used to suggest using the image openjdk:8-alpine but it wasn’t updated in a year, so I now suggest using openjdk:8-jre which seems to be actively maintained!

I also added “nogui” at the end of the command as Spigot does now accept and understand it.

Like the previous post, but better!

So, if you read my previous post you should now know how to run a Minecraft server (vanilla) inside of Docker. The same thing is possible with SpigotMC but requires a slightly different command.

The Command

docker run --user 1001:1001 -tid -p 25565:25565 --name minecraft-spigot --mount type=bind,src=/home/minecraft/server-spigot,target=/srv/minecraft -w="/srv/minecraft" --restart always openjdk:8-jre java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Xms4096M -Xmx4096M -XX:+UseConcMarkSweepGC -jar spigot.jar nogui

What’s different?

We give the container a different name, here being minecraft-spigot instead of minecraft-vanilla, and we mount the proper source directory where SpigotMC resides in. Furthermore, we remove the nogui option as that does not exist in SpigotMC. We are also assigning more memory to the SpigotMC server, although 1 GB should be fine, 4 GB is recommended, especially if the server has many concurrent players. We are also adding the option -XX:+UseConcMarkSweepGC as described in the official SpigotMC documentation. And of course, we’re now running spigot.jar instead of the vanilla jar.

Breaking down the command

To fully understand what’s going on, you should read my previous post on how to run your Minecraft server in Docker: