Skip to content

Minecraft (Java) Server in Container Manager on a Synology NAS

Important or Recent Updates
Historic UpdatesDate
Guide refreshed and updated for Container Manager22/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
Historic updates.

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

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.

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.


Folder Setup

First we need to set up a couple of folders to store our World and config files.

Using File Station create the following folders.

/docker/minecraftjava

/docker/projects/minecraftjava-compose

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!)

YAML
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/tcp
      - 25565:25565/udp
#      - 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 VersionTag to Select
v1.18x and upimage: itzg/minecraft-server:latest
v1.17ximage: itzg/minecraft-server:java16
v1.16 and belowimage: 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)ValueComment
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)TRUEThis accepts the Minecraft EULA, without this the server will not run
MEMORY (9)2GAmend 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!
TYPE (10)VANILLA
BUKKIT
SPIGOT
PAPER
TUINITY
MAGMA
MOHIST
CATSERVER
CURSEFORGE
SPONGEVANILLA
FABRIC
Choose a version from the list
VERSION (11)LATESTYou can change this to any a specific version if you want e.g 1.13
LEVEL (12)WORLDThis 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)FALSEChange 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.
The basics

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.

SectionValue
Service ProviderSynology
HostnameThis will be the address used to identify your NAS so make it personal to you not specific to this guide.
minecraft.synology.me = BAD
myawesomenas.synology,me =GOOD
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 EncryptTick this box
Enable HeartbeatTick 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.



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.2

18 Comments

  1. Opie1Kenoby Opie1Kenoby

    Hello,

    I made all steps for the guide (including step 1/2/3 on docker / users/bridge)

    But i can’t connect to the server whith minecraft

    I add the server with DNS first time and IP second time, and same problem, that cannot connected to it.

    Any ideas ? (Ofc i’ve open corretly port on my router)

    Regards

    • Dr_Frankenstein Dr_Frankenstein

      If you are not able to connect via the IP address check that you don’t have the Firewall blocking anything, does the Server show as up when you add it to the Minecraft server list?

      • Opie1Kenoby Opie1Kenoby

        My bad, children’s didn’t inform me that it’s a different version between PC and mobile
        So…. Works fine withe the other tips

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!