Important or Recent Updates
|Guide refreshed and updated for Container Manager||22/07/2023|
|Also added a new section on how to open up Remote Play using your own address.||02/10/2023|
|Added additional security option to the compose to restrict the container from gaining new privileges also made the additional java variable as optional.||25/10/2023|
In this guide I am going to take you through the steps to get a Minecraft JAVA server up and running in Docker on a Synology NAS. If you are looking to host a server for a Console or Mobile you will want to see my Bedrock Edition guide.
Just an initial warning, Minecraft loves RAM! The more you can feed it the better the performance you will see. So if you are setting this up on a base model Synology with 2 GB of RAM expect performance issues!
The fantastic documentation on how to use the server once it is running can be found here
In order for you to successfully use this guide please complete the setting up a docker user guide.
As Container Manager now supports using Docker Compose in the UI we will be using it as it will save you lots of time and steps!
What on earth is a Docker Compose? Docker Compose allows us to define how Docker should set up one or more containers within a single configuration file. This file is yaml formatted and Container Manager uses the Projects feature to manage them.
First we need to set up a couple of folders to store our World and config files.
Using File Station create the following folders.
Container Set Up
Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project, then on the right-hand side click ‘Create’.
In the next screen we will set up our General Settings.
‘Project Name’ will be ‘minecraft-java’
‘Path’ click the button and select the folder we created earlier in ‘/docker/projects/minecraftjava-compose’.
‘Source:’ change the drop-down to ‘Create docker-compose.yml’.
Next we are going to drop in our docker compose configuration, copy all the code in the box below and paste it into line ‘1’ just like the screenshot. (Yes line 16 is massive!)
services: spigotserver: image: itzg/minecraft-server:latest container_name: minecraft environment: - UID=1234 #CHANGE_TO_YOUR_UID - GID=65432 #CHANGE_TO_YOUR_GID - EULA=TRUE - MEMORY=2G - TYPE=SPIGOT - VERSION=LATEST - LEVEL=world - SERVER_PORT=25565 #leave me - ONLINE_MODE=FALSE - SERVER_NAME=NAME OF YOUR SERVER # - JVM_XX_OPTS= #optional see below volumes: - /volume1/docker/minecraftjava:/data:rw ports: - 25565:25565 # - 25575:25575 optional rcon port see warning below network_mode: synobridge security_opt: - no-new-privileges:true restart: unless-stopped
Editing the Config and Environment Variables
Let’s make some edits to the compose in order to customise the server, I am covering the basics here, ITZG has great information over on the documentation which covers the many additional variables you can tweak!
Please keep in mind that yaml formatting is very specific, so keep things lined up as per the original!
First lets decide which version of the container we want as different versions of Minecraft require different JAVA versions.
If you want the latest and greatest version you don’t need to change anything, however if you like old school Minecraft then edit line 3 with the ‘Tag’ below.
|Minecraft Version||Tag to Select|
|v1.18x and up||image: itzg/minecraft-server:latest|
|v1.16 and below||image: itzg/minecraft-server:java15|
We are now going to amend some key variables to make sure the container has access to our folders and setup some basic server config.
The values below go after the = on the appropriate line.
Please note if you decide to enable the RCON Port please change the default password especially if you open your server up to the Internet otherwise you will get hacked! See the GitHub for more details.
|Variable (Line No)||Value||Comment|
|UID (6)||Change it to the UID you obtained earlier in the first setup guides|
|GID (7)||Change it to the GID you obtained earlier in the first setup guides|
|EULA (8)||TRUE||This accepts the Minecraft EULA, without this the server will not run|
|MEMORY (9)||2G||Amend the number to the amount of memory you want to allocate to the server this will depend on your system or server type you are running, generally more = better!|
|Choose a version from the list|
|VERSION (11)||LATEST||You can change this to any a specific version if you want e.g 1.13|
|LEVEL (12)||WORLD||This is what the world folder will be called when saved, so change to help identify if you decide to set up multiple worlds|
|ONLINE_MODE (14)||FALSE||Change this to TRUE if you want to register the server with the Mincraft mothership keep in mind you will need a legit version of Minecraft to play on the server if this is enabled!|
|SERVER_NAME (15)||Give it a nice name!|
|JVM_XX_OPTS (16)||-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:InitiatingHeapOccupancyPercent=15|
I obtained these from a lot of digging around for optimising server JAVA performance you are free to edit or use them.
Once you have made all your required edits click ‘Next’
Nothing to change on the next screen click ‘Next’ again..
On the final screen just click ‘Done’ and you will see a new window appear which will kick of downloading of the required container image and configure your server.
Server startup time
The first time the server launches it may take a few minutes for the server files to download and the world to be generated. You can track the progress by going into the ‘Containers’ tab and clicking on details for the Minecraft container, then either viewing the terminal or log tabs.
After a few minutes you should be able to connect to your server using the IP of your NAS using port 25565
(Optional Extra for Remote Play)
So your friends have an easy way to play remotely lets set up an address for them to connect to!
Before we start, make sure you have registered for a Synology Account as we are going to be using their DDNS service. https://account.synology.com/en-uk/register/
DDNS (Dynamic Domain Name System)
A DDNS address allows you to get external access to Minecraft via an address provided by Synology, this is useful on home internet connections where your ISP will change your IP address on a regular basis.
In the DSM Control panel go to ‘External Access’ and then to the ‘DDNS’ tab
Click on ‘Add’, then fill out the following sections.
|Hostname||This will be the address used to identify your NAS so make it personal to you not specific to this guide.|
minecraft.synology.me = BAD
|Email:||Log into your Synology account|
|External Address (IPv4)||This should be filled in automatically|
|External Address (IPv6)||This should be filled in automatically if your ISP is using IPv6|
|Get a Cert from Let’s Encrypt||Tick this box|
|Enable Heartbeat||Tick this box|
Now press OK, DSM will apply your settings. It can take a few moments to set up and the DSM interface will refresh. You will likely receive a certificate error which you will need to accept to get back into DSM.
The final step will be to forward port 25565 on your Router to your NAS IP. You will need to refer to your Routers manual on how to do this. As we are using the default Minecraft Java port other players just need to use the address you set up to connect.
Buy Me a Coffee or Throw me some Sats
If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me get the odd beverage. Plus 10% goes to the devs of the apps I do guides for every year.