Skip to content

Minecraft (Java) Server in Docker on a Synology NAS

Please note if you are using DSM7.2 or higher you should use the Container Manager version of this guide from the menu.
UpdateDate
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
Historic updates now at the end of the guide.

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 VersionTag to Select
v1.18x and upLatest or JAVA17
v1.17xJAVA16
v1.16 and belowJAVA15

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.

variableValueComment
UIDThis will be prefilled with 1000 change it to the UID you obtained earlier
GIDThis will be prefilled with 1000 change it to the GID you obtained earlier
EULATRUEThis accepts the Minecraft EULA, without this the server will not run
TYPESPIGOTYou can change this as per the list below
VERSIONLATESTYou 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=15These variables are used to increase the performance of the server – Copy and paste this exactly
MAX_MEMORY2GAmend 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

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/FolderMount 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 HistoryDate
Added Docker Compose details03/05/2021
Updated to show which version of the image to download09/06/2021
Cleaned up the Environment Variables section and included some new JAVA optimisations24/11/2021
Screenshots update to DSM7 and tweaked the guide wording22/01/2022
DSM7.1 Update with new screenshots and steps24/05/2022
Added new port settings and Docker Bridge Network23/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 required12/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
Update History

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.

Published inGaming 7.1

109 Comments

  1. John John

    Hi,
    Thanks for this brilliant guide. I set it all up and worked perfectly as bedrock. Did this so my kids would have a super safe closed environment for them and their friends, all good.

    After months of stability suddenly we can’t access the “world” via the Mine craft app as the server is reported as out of date. In settings it should be latest but it’s failing to update with the message in the log file “ minecraft download page failed”.

    Any advice on how to sort this?

    Thanks.

  2. Uwe Uwe

    Hi

    Nice guide, especially the part with the restricted user policy. Can I use this methodology also when I set up other docker containers?

    Cheers

    • Dr_Frankenstein Dr_Frankenstein

      Hey, all the Linux server containers have the UID values, you often need to check the read me to see what the container requires or how it expects permissions to be set.

  3. Cody Morgan Cody Morgan

    Hello,

    I followed this guide and was able to startup a Minecraft server with no problems. I am now looking at trying to add Forge Mod so I can add Mods to my server but I am not sure what the steps are to install forge. I have downloaded the .jar file forge-1.17.1-37.0.126-installer.jar but am not sure how to install this on the server. Is this possible within the container I have created using your steps or do we have to create an entire new container with this forge package and if so are you able to provide the steps on how to do that?

    Thanks,
    Cody

    • Dr_Frankenstein Dr_Frankenstein

      Hey, you can change the server type with the ‘Type’ environment variable to CURSEFORGE.. I assume you can then put the mods in the MOD folder that is created in the folder you mapped.

      • Cody Morgan Cody Morgan

        Below is the log file after only changing the Type from VANILLA to CURSEFORGE if that helps.

        [init] Resolved version given LATEST into 1.17.1
        [init] Resolving type given CURSEFORGE
        [init] **********************************************************************
        [init] NOTE: Some mods and modpacks may require Java 8.
        [init] If so, use itzg/minecraft-server:java8
        [init] **********************************************************************
        [init] Looking for Feed-The-Beast / CurseForge server modpack.
        [init] ERROR: FTB_SERVER_MOD is required to be set

        • Dr_Frankenstein Dr_Frankenstein

          Try stopping the container deleting everything inside the /docker/minecraft folder and starting it up again.

          • Cody Morgan Cody Morgan

            I tried this and it wont create anything within the folder now. Log stops and gives the following error at the bottom of the log and then tries to restart again over and over giving the same error.

            ERROR: FTB_SERVER_MOD is required to be set

            It not installing the Forge mod for me. From what I can find online this needs to be installed and then the environment value can point to the mod. Is this true or are you saying this should just create and install everything and work, if that is the case then its not working like that.

          • Cody Morgan Cody Morgan

            I was actually able to get it working by changing the type from CURSEFORGE to FORGE. It downloaded and installed it all for me then. Thanks for your help.

  4. Lee Lee

    Thank you so much for this! Everything went swimmingly until I try and connect to it from inside Minecraft and it can’t find it…

    • Dr_Frankenstein Dr_Frankenstein

      Have you manually added the server as the built in automatic search never seems to find anything

      • Lee Lee

        I have yeah, tried with and without the port. It seems like it finds something, moves to “encrypting” and then says it can’t connect!

            • Dr_Frankenstein Dr_Frankenstein

              When you add the server it should only need the IP of your NAS without the port number.. when you add it does it show up like this?
              Minecraft Server Page

          • Lee Lee

            I can’t connect to it at all now, so no it just says it failed to connect. I seem to be having bigger problems with the container; it’s crashing every 20 or so minutes so I think i might just kill the container and start the process again to see if it was something i did…

  5. Afterburn Afterburn

    Hi Dr Frankenstein,

    Thanks for the terrific guide. I had referred to the Docker repository also, but this is a lot more specific for the Synology deployment. I’m using a 216+II with 8Gb Ram and DSM 7.0.1-42218

    I stuffed up the directory settings in Advanced tab prior to running on the first attempt without your notes. I deleted and restarted. Running no problems so far. I intend to use the whilelist.json to admit my sons friends to the server. I’ll update the environment to reflect its use.

    I also tried LEVEL_TYPE=AMPLIFIED in environment but I haven’t got it going.

    I’ve tested on the LAN side OK, am now to test on the WAN side.

    Cheers,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!