Skip to content

Minecraft (Java) Server in Docker on a Synology NAS

UpdateDate
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

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.

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

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.18xLatest 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 initial setup 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. This will ensure DSM is still usable when the server is running.

In this case I am leaving this as the defaults, you can always come back and tweak these settings later once the server is set up.

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.

Advanced Tab

On the first tab enable ‘Auto Restart’ this will ensure Minecraft will automatically start up whenever you reboot your NAS.

Volume(s)

We can now move onto the volume tab in which we will be specifying 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

Network

We are not going to be specifying specific ports for Minecraft to use as we want to keep things simple, tick the ‘Use the same network as Docker Host’

You do not need to set up anything on these tabs.

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

variableValueComment
UIDUID you obtained earlier
GIDGID 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
  • CURSEFORGE
  • SPONGEVANILLA
  • FABRIC

You have now completed the hard part of the guide.

Click on OK and you will be taken back to an overall summary screen, just do a quick sanity check to make sure they are correct. If you want to launch the server immediately check the box and click on finish.

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.

Docker Compose

You can use the below code saved as minecraft.yml in the ‘/docker/minecraft’ share, this will do the entire process above in one quick command via SSH. Ensure you change the variables to your own.

version: "3.8"
services:
  spigotserver:
    image: itzg/minecraft-server:latest
    container_name: minecraft
    environment:
      - UID=YOURUID
      - GID=YOURGID
      - 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
      - MEMORY=2G
      - TYPE=SPIGOT
      - VERSION=LATEST
      - FORGEVERSION=RECOMMENDED
      - SPONGEBRANCH=STABLE
      - SPONGEVERSION=
      - FABRICVERSION=LATEST
      - LEVEL=world
      - PVP=true
      - DIFFICULTY=easy
      - ENABLE_RCON=true
      - RCON_PORT=25575
      - RCON_PASSWORD=
      - LEVEL_TYPE=DEFAULT
      - SERVER_PORT=25565
      - ONLINE_MODE=FALSE
      - SERVER_NAME=NAME OF YOUR SERVER
      - ENABLE_AUTOPAUSE=false
      - AUTOPAUSE_TIMEOUT_EST=3600
      - AUTOPAUSE_TIMEOUT_KN=120
      - AUTOPAUSE_TIMEOUT_INIT=600
      - AUTOPAUSE_PERIOD=10
      - REPLACE_ENV_VARIABLES=FALSE
      - ENV_VARIABLE_PREFIX=CFG_
      - EULA=TRUE
    volumes:
      - /volume1/docker/minecraft:/data:rw
    network_mode: host
    restart: unless-stopped
sudo docker-compose -f /volume1/docker/minecraft.yml up -d


Throw me some bits or buy me a coffee?

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running the site, you can even buy me a coffee 🙂

Buy Me A Coffee
Doge / Ethereum / Bitcoin
Published inGaming

68 Comments

  1. Everything here works as explained except for the version info. If I change the VERSION environment variable to anything later than 1.17.1 (ie: 1.18.1) or use “LATEST” it doesnt work. Is there any work around or resolution to work with later versions?

    • Dr_Frankenstein Dr_Frankenstein

      I see you posted over on the Github page, it looks like people are having to manually download 1.18 at the moment as they are considered experimental builds you can get it from here, you will need to place it in the minecraft folder and name it in line with you other server versions. It might be worth switching to a Spigot build as they are downloading correctly https://www.minecraft.net/en-us/article/minecraft-java-edition-1-18-1a

  2. meynti meynti

    It is possible to run a Minecraft Modpack from Curseforge? Ive got the 220+ with 10GB RAM.
    You could do a tutorial aswell?

  3. Woch Woch

    Hi, I could run the minecraft java server on my DS218+ nas with support from this website. My children are so happy that they can play minecraft in their own server. But I found that it is not able to join the game outside of my home network so their friend cannot join the server. We are living in a temporary residence and therefore I don’t have right to change the setting of the network modem. Do you know how to join the server from out side of my home network.

    • Woch Woch

      I changed the setting of port forwarding on the network modem and I could join the game out side of home network.

      • juxdz juxdz

        Can you make a tutorial out of it

Leave a Reply

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!