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
Updated with additional compose information to enable the interactive shell, so commands can be issued to the server, also removed the table relating to versions and linked to the official version with all tags. Amended instructions accordingly.12/07/2024
Removed the user defined bridge ‘synobridge’ as it is not really required for this setup as the container will create its own isolated bridge13/07/2024
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.

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.

SectionSetting
Project Name:minecraftjava
Path:/docker/projects/minecraftjava-compose
Source: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:tag #edit this line as per the tag section
    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
    stdin_open: true
    tty: true
    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!

Tags

First lets decide which version of the container we want as different versions of Minecraft require different JAVA versions.

In order to get the right version of Java for the version of Minecraft you want to run it involves editing the container tag. There are lots of versions to select see this really handy table in the documentation

https://docker-minecraft-server.readthedocs.io/en/latest/versions/java/#image-tags

Once you know the correct tag amend the image line accordingly for example:

image: itzg/minecraft-server:java21

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.

VariableValueComment
UIDChange it to the UID you obtained earlier in the first setup guides
GIDChange it to the GID you obtained earlier in the first setup guides
EULATRUEThis accepts the Minecraft EULA, without this the server will not run
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, generally more = better!
TYPEVANILLA
BUKKIT
SPIGOT
PAPER
TUINITY
MAGMA
MOHIST
CATSERVER
CURSEFORGE
SPONGEVANILLA
FABRIC
Choose a version from the list
VERSIONLATESTYou can change this to any a specific version if you want e.g 1.13
LEVELWORLDThis is what the world folder will be called when saved, so change to help identify if you decide to set up multiple worlds
ONLINE_MODEFALSEChange 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_NAMEGive it a nice name!
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

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, please note that the section below opens port 443 however you will also need to forward port 25565.

External Access

You have some choices when it comes to making your new container accessible from outside your home network, these come with different levels of security and convenience. This mini section is generic but covers the basics of getting this guide up and running and is entirely optional.

  • Synology’s DDNS (Dynamic Domain Name System) with a TLS Certificate and Reverse Proxy
    This is useful if you have some family members or friends that need access to something like Overseerr or Jellyseer and is covered below.

  • Tailscale or Wireguard VPN
    If just you are accessing these services, and you don’t want to expose them to the internet this would be the more secure choice. See my other separate guides.

  • Cloudflare Tunnels
    I don’t currently use these, so I would recommend watching the Wundertech guide on how they work.

A note on Double NAT or CGNAT
Unfortunately more ISPs are moving to these methods of address allocation as the IPv4 address space is getting low on available addresses. If your ISP is doing this your choices are more limited.

You can test if this is the case by checking the WAN IP on your Router/Modem settings and then comparing it to the one shown on portchecker.co. If they are different you are likely Double NAT and will either need to see if you can pay your ISP for a standard IPv4 address or use Tailscale or Cloudflare Tunnels for access.

Using the built-in tools on DSM

The first step of this process is to forward port 443 on your Router to your NAS IP Address, how you do this will depend on your router model, so please refer to its manual.

Router (External):443 > NASIP (Internal):443

Next 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/ If you already have this set up move to the next step.

DDNS (Dynamic Domain Name System)

A DDNS address allows you to get external access to your container via an address provided by Synology, this is useful on home internet connections where your ISP will change your IP address on a semi-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 unique address just for you so keep the name generic.
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.

Reverse Proxy

We are going to set up a reverse proxy subdomain for the address you just register. This means you and your users can access the container without using a port number as it will route all traffic through the secure 443 port.

Go back into the Control Panel and access the ‘Login Portal’ then in the ‘Advanced’ tab click ‘Reverse Proxy’ and then click on ‘Create’.

We are now going to enter some rules, so when you or your users access the URL specified the request will automatically be sent to the containers web UI.

Use the settings below, you will need to amend the Hostname sections in line with the hostname you registered earlier, and the IP of your NAS.

SettingValue
Reverse Proxy Name:Give it a meaningful name in line with the container you are setting up.
Protocol:HTTPS
Hostname:containername.xxx.synology.me
containername‘ will be the name you want to use to access this container
.xxx.synology.me‘ will be the exact name you registered earlier
Port:443
Protocol:HTTP
Hostname:‘localhost’ or your NAS IP address
Port:The UI Port Number from the yaml in the guide you are following

On the second tab ‘Custom Header’ click on Create then WebSocket, this will add two entries for WebSockets to function correctly, you can now press save.

You should now be able to access the web UI of the container by going to the address you just set up in the reverse proxy, it will be a secure connection, and you should have no certificate errors.



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

24 Comments

  1. Buzz Buzz

    Thank you very much Dr Frankenstein for these great tutorial! I think some people habe issues with the DDNS connection because they use a DS_Lite tunnel and dont have an IPv4. You can join your Syno-Tools with quickconnect but not an MC-Server over DDNS.

    I have a question because i use Docker/Container Manager first time: I try to administrate the Game with the Terminal in the Container, but there is everything black. How can i see the text an give commands like /op etc?

    • Dr_Frankenstein Dr_Frankenstein

      Hey Buzz apologies for the long delay in replying..

      I need to get under the covers with IPv6 as more ISP are moving to it and I don’t fully understand all the changes around how it works, from some very basic skimming so far it seems like NAT is no longer in place as every single device/virtual device has a directly connectable IPv6 address..

      My own ISP are still IPv4 so I would need to figure out how to test things…

    • Dr_Frankenstein Dr_Frankenstein

      Oh, sorry and for the second part, make sure you click Create on the top left to open a session into the container

  2. Matthew Dies Matthew Dies

    I’ve tried the DDNS step, but I’m getting “Connection refused” when trying to join via Direct Connection. However, it works when using the local IP. Do you know what this might be?

    • Dr_Frankenstein Dr_Frankenstein

      Hey, when using the DDNS address you need to add via ‘Add Server’ not the Direct Connection option.

  3. Armando Armando

    Have you gotten it to work for external access? I’m setting the server for my kids and would like his friends to play from their homes.

    • Dr_Frankenstein Dr_Frankenstein

      It should be working for External access just fine. Give me 10 mins as I thought I duplicated the way to set it up over from the Bedrock version but clearly not!

      • Armando Armando

        It does not work for me. I have forwarded the ports, and nothing has changed. I only have the issue with Minecraft. Homebridge, portainer, and gitea, all work fine.
        I am not the only one. I have seen some Reddit threads with the same problem but no solution.

        Thanks for helping!

        • Dr_Frankenstein Dr_Frankenstein

          Can you check that when opening the port on your Router that you are selecting both TCP and UDP. Also Do you have the Firewall enabled on the Syno side as you will also need to add an exception accordingly

  4. Brian Brian

    Thank you for the guide, this worked perfectly and our server is up and running. The only challenge I am having is how to access the terminal so that we can enter server commands. I am able to open and see terminal within container manager but not able to type in the terminal.

    • Dr_Frankenstein Dr_Frankenstein

      Hey sorry your comment got flagged as Spam did you get this going or still an issue?

      • Gummy Gummy

        Hey, thanks a lot for this guide, it’s still a problem for me, the server is working fine but the terminal is not showing anything and I can’t write to it.

        • Dr_Frankenstein Dr_Frankenstein

          When you click Create on the same section it should then let you type into the new bash session.

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!