Please note if you are using DSM7.2 or higher you should use the Container Manager version of this guide from the menu.
This guide has reached the end of its updates as most people are now on the latest DSM update - This guide is correct as of 08/12/2023 however no further updates will be added.
Update | Date |
---|---|
Added a note in relation to enabling the RCON port and if you expose it to the internet you MUST change the default password. | 22/04/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.
The fantastic documentation on how to use the server once it is running can be found here
https://docker-minecraft-server.readthedocs.io/en/latest/
Let’s Begin
In order for you to successfully use this guide please complete the setting up a docker user guide, or have your ID details to hand.
Step 2: Setting up a restricted Docker user
Step 3: Setting Up a Docker Bridge Network
Downloading the Container
Open up Docker within DSM and navigate to the ‘Registry’ tab and search for ITZG in the keyword box.
Within the results right click and download the ‘ITZG|Minecraft-Server’, When it asks which version number to download select the one that you require based on the table below
Minecraft Version | Tag to Select |
v1.18x and up | Latest or JAVA17 |
v1.17x | JAVA16 |
v1.16 and below | JAVA15 |
Setting up the container
Now we have downloaded the container and got hold of our user IDs we can move onto the next stage.
Go back into Docker and click on the ‘Image’ tab, in the list of your containers select the ITZG Minecraft server, and click on ‘Launch’
You will be greeted with the Network screen, we will be using the ‘synobridge’ network we created earlier select it from the list and click Next.
Next you will be greeted with the General Settings screen, this is where you can start specifying some of your preferences.
Minecraft can be fairly CPU heavy so if you are running the server on a lower specification Synology box you will probably want to set limits around the CPU priority or Memory Limit. This will ensure DSM is still usable when the server is running.
You can change the name of the container to anything you like, and you may want to enable Auto Restart as this will ensure the server starts automatically if you reboot your NAS.
Next up we are going to click on the ‘Advanced Settings’ button, this will take you to a new window with a number of tabs which we are going to work through.
Environment Variables – GID, UID, Server Type and EULA
We are now going to set up the specific options for the server including what type of server you would like to run and even a specific version.
Each of the values below are added by clicking the ‘Add’ button at the top of the screen and then entering each of the values below
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! See the GitHub for more details.
variable | Value | Comment |
UID | This will be prefilled with 1000 change it to the UID you obtained earlier | |
GID | This will be prefilled with 1000 change it to the GID you obtained earlier | |
EULA | TRUE | This accepts the Minecraft EULA, without this the server will not run |
TYPE | SPIGOT | You can change this as per the list below |
VERSION | LATEST | You can change this to any a specific version if you want e.g 1.13 |
JVM_XX_OPTS | -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 | These variables are used to increase the performance of the server – Copy and paste this exactly |
MAX_MEMORY | 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 |
Server Types
- VANILLA
- BUKKIT
- SPIGOT
- PAPER
- TUINITY
- MAGMA
- MOHIST
- CATSERVER
- SPONGEVANILLA
- FABRIC
See the full list here
Links / Execution Command
You do not need to set up anything on these tabs.
Press ‘Save’ to go back to the initial setup screen, then press ‘Next’
Port Settings
You will now see the Port Settings screen. You will need to type in the ‘Local Port’ to match the ‘Container Port’ shown on the right-hand side this will avoid the container being assigned random ports when it is started. When set press Next.
As per the earlier note if you decide to enable RCON you will need to add its port mapping here.
Volume Settings
We can now specify the directory where Minecraft will store its configuration files.
Click on Add Folder, click on the docker folder and create a new sub-folder called ‘minecraft’ select this folder and click ‘select’
Now we need to specify where this folder will be mounted inside the container. As per the screenshot/table below, enter /data into the ‘Mount path’.
File/Folder | Mount path |
---|---|
docker/minecraft | /data |
Click on Next and you will be taken to an overall summary screen, just do a quick sanity check to make sure the options are correct. If you want to launch the server immediately check the box and click on Done.
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.
All other server settings can be configured using the standard Minecraft server.properties file, I won’t be covering that here as there are extensive other guides out there.
Update History | Date |
Added Docker Compose details | 03/05/2021 |
Updated to show which version of the image to download | 09/06/2021 |
Cleaned up the Environment Variables section and included some new JAVA optimisations | 24/11/2021 |
Screenshots update to DSM7 and tweaked the guide wording | 22/01/2022 |
DSM7.1 Update with new screenshots and steps | 24/05/2022 |
Added new port settings and Docker Bridge Network | 23/07/2022 |
Fixed the missing port settings section! | 16/11/2022 |
Removed port 25575 (RCON) as could pose a security issue if exposed to the internet – You can add manually if required | 12/03/2023 |
Compose version number removed 3.x not required, and some minor wording amendments. | 08/04/2023 |
Amended the path to save the compose file – this is for security, so the container has no access to the file contents. | 14/04/2023 |
Looking for some help, join our Discord community
If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!
Buy me a beverage!
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 stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.
Hi guys, I had a minecraft server running for a while now but I can’t really keep using it because it lags all the time now and I have no clue why it started suddenly. There are 3 players at most on the server and we have built just a few small buildings.
Is there anything I am missing or is it just that the NAS hasn’t gotten enough computing power? The same world copied to my desktop pc and run on a local server works flawless.
I got a DS720+ with 12GB RAM.
[Server thread/WARN]: Can’t keep up! Is the server overloaded? Running 2161ms or 43 ticks behind
Thats the error message I get.
I notice that when the problems start, and I check the resource monitor my volume is constantly writing at 4-6MB/s
Once that goes down everything works again, I have no idea what triggers those writing spikes.
Have you tried increasing the amount of ram available to the server. I believe these is a environment variable which is defaulted to 1GB
Install all made as yo u have explained and unexpected close in less than a minute. I have a DSM7 and DS720+
Are you getting an error in the logs at all?
Is there anything in the logs to say why it closed. Should be a tab in the container.
Hi,
Many thanks for this guide. I use DSM7 and had to do a couple of tweaks. First of all java was not installed so I had to install it via a third party package. I also had to change the environment variables for java according to this. Otherwise it works fine.
Thanks,
Bengt
Hey, you don’t need to install any additional packages, a docker container has all the required packages within it. You should be able to uninstall the java package. What Diskstation model do you have and which java setting did you use?
Thanks for the quick response. Yes, it worked now with removing the java package. I read the log files when I could not start that there was a java version problem and after serching I saw that someone said that java was removed when you updated to DSM 7 so I installed a third party package and thought that was the reason. I have a DS716+II.
Now it is working fine. Thanks again.
Hi,
This is a great tutorial, I managed to set up the docker and the Minecraft server pretty fast.
However, when I add the server in Minecraft – either with local ip or public ip -, the SERVER_NAME and either ports (25565, 25575), Minecraft cannot locate the server.
I don’t have the firewall enabled on my NAS.
I restarted Docker and I even restarted the NAS, still, no luck. I have DSM 7.0
What could be the issue?
Usually the last line in the log is:
[Server thread/WARN]: handleDisconnection() called twice
Not quite sure what that means. Can it be that 1.5 gigs of memory is not enough?
Thanks for your help in advance!
Hey Andras – Did you manage to connect to the server yet? double check you put the ports correctly on the docker config, however if you are getting that error in the logs it would suggest something else is up, have you tried specifying a different version of Minecraft in the environment variables? Reach out on Discord if you have an account its a bit easier to chat than the comments.
(Comment moved to correct tutorial)
Thanks a lot for the tutorial and photos step by step. I have it running, but connecting to the port 25575 or 25565 doesn’t work even when I ssh to the NAS and try 127.0.0.1:25575
Running netstat doesn’t show anything listening on that port when the container is running (nly shows docker-proxy):
root@nas:~# netstat -tunlp | grep 25
tcp 0 0 0.0.0.0:49156 0.0.0.0:* LISTEN 11425/docker-proxy
tcp 0 0 169.254.129.117:49160 0.0.0.0:* LISTEN 20752/synovpcd
udp 0 0 192.168.0.255:137 0.0.0.0:* 20451/nmbd
udp 0 0 192.168.0.255:138 0.0.0.0:* 20451/nmbd
udp 0 0 0.0.0.0:5353 0.0.0.0:* 20525/avahi-daemon:
udp 0 0 169.254.129.117:55900 0.0.0.0:* 20752/synovpcd
udp 0 0 0.0.0.0:50881 0.0.0.0:* 20525/avahi-daemon:
udp6 0 0 :::5353 :::* 20525/avahi-daemon:
udp6 0 0 :::49523 :::* 20525/avahi-daemon:
what am I missing here please?
Hey, can you try stopping the container and in the environment variables check to see if there is one called SERVER_PORT – if its missing add it with the variable of 25565 – see if that then works.
thanks, I got it working after changing few things – local port and internal port needed to be filled in – initially one of them was empty (sorry, don’t remember which one)
For me the issue was using 2 ports on Tcp. When I saw it I thought it was funny, but tried it anyway. I needs to be 1 port number listed twice. One for UDP, and one for TCP. Then you should be able to connect on that port number.
I will make it a little clearer as they can both be TCP one is 25565 to access the server the other is 25575 for RCON
Thanks, it worked!!. Just one thing, I think this container is ignoring the PUID and GUID, it’s creating everyting with UID/GID 1000