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

In this guide I am going to take you through the steps to get a Minecraft server up and running. This applies to both a Vanilla and modded server.

We will be using DSM6 and the latest version of Docker at the time of writing. The server I run is now open to anyone who want’s to play, its usually up and running most of the time. You can see its status in the widget on the left of this page 🙂

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.

Minecraft VersionTag to Select
v1.17 and upLatest
v1.16 and belowJAVA15
Search and Download

Setting up a Docker User for Minecraft and Obtaining the PGID and PUID

In previous versions of this guide we used your default admin account for each container, this is not very secure so please now follow the separate setup guide and then head back here.

Setting up the container

Now we have downloaded the container and got hold of our user IDs we can move onto the next stage, where we will configure the Docker container. First 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’

Time to start

You will be greeted with the initial setup screen, this is where you can start specifying some of your preferences.

As this is a Minecraft server it will likely use as much memory and CPU usage as you allow it, if you are running the server on a lower specification Synology machine you will probably want to set limits around the CPU priority and memory usage to 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 setup.

The initial setup screen

Next up we are going to setup some other parts, click on the ‘Advanced’ button.

Advanced Tab

On this first tab you can decide if you want to create a shortcut to the server on the DSM desktop and also if you want the server to start up automatically if you ever restart your Syno, this is useful if you don’t want to login to manually startup the server.

Advanced Settings

Volume(s)

In the next tab we need to setup where we want the various Minecraft world files to reside, having these outside of the container will mean you can make backups of the entire server, great if someone decides to flood the map with Lava!

Personally, I setup folders for each of the  containers I am running in the default Docker directory as this keeps things nice and tidy.

We are going to mount a single directory for this container, the internal “/data” directory to the NAS “/docker/minecraft” seen the screenshot to see exactly how this is laid out.

Specify where you world files should reside

Network

You do not need to adjust and settings in this tab.

Port Settings

By default docker will automatically assign external ports to your Docker container, however we will never know what they are until the container is launched and also they may change upon a reboot, so we will need to assign some specific ports.

In the case of this container Minecraft uses high value port number so it’s unlikely to clash with any other containers or ports already used by DSM. So we are just going to enter the same port numbers on the left hand column.

Local PortContainer PortType
2556525565TCP
2557525575TCP
Assign your ports

Environment Variables – PGID , PUID, 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.

*Please note that you must not change the UID and GID options in the first red box.

First up Click on the + sign at the top of the options page, in the ‘Variable’ box type PGID and enter the value you obtained earlier, repeat this step for the PUID. (See screenshot)

In addition to this we have to accept the Minecraft EULA so you will add an additional variable called EULA with the value set to TRUE.

You can now specify the type of server you would like to run by amending the value next to the TYPE variable.

  • VANILLA
  • BUKKIT
  • SPIGOT
  • PAPER
  • TUINITY
  • MAGMA
  • MOHIST
  • CATSERVER
  • CURSEFORGE
  • SPONGEVANILLA
  • FABRIC

If you want to run a specific version of the server you can amend the VERSION variable from LATEST to for example 1.13

*Please note the screenshot below has been updated, as you can see after you run the server for the first time a lot of additional variables are automatically added. Ignore the GID and UID towards the top of this screenshot we only need to fill in the items at the bottom!

You have now completed the hard part of the guide, click on OK and you will be taken back to an overall summary screen, this is just a summary of the settings you have entered, 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.

Final summary page

Server startup time

The first time the server is launched it may take a few minutes to start as the files are downloaded and the world in generated, this time will depend on how fast your Synology performs, you can track the progress by going into the ‘Containers’ tab and clicking on details, and 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 to do the entire process above in one quick command via SSH.

version: "3.2"
services:
  spigotserver:
    image: itzg/minecraft-server:java15
    container_name: minecraft
    environment:
      - UID=YOURPUID
      - GID=YOURPGID
      - JVM_XX_OPTS=-XX:+UseG1GC
      - 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
    ports:
      - 25565:25565/tcp
      - 25575:25575/tcp
    restart: unless-stopped
sudo docker-compose -f /volume1/docker/minecraft.yml up -d --remove-orphans

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
  • Bitcoin
  • Ethereum
  • Tether
  • Xrp
  • Polkadot
  • Binance coin
  • Litecoin
  • Bitcoin cash
  • Dogecoin
  • Tron
  • Monero
  • Omisego
Scan to Donate Bitcoin to bc1qfznx5kxad9k9z5t9y79mkm9ukfexan9a6wrzl0

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x162fc7781D3C6c6f27197A3A92567b5DAF258f19

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Tether to 0x162fc7781D3C6c6f27197A3A92567b5DAF258f19

Donate Tether to this address

Scan the QR code or copy the address below into your wallet to send some Tether

Scan to Donate Xrp to rKGpNHetksTn4dgwgpiTkg8JM4uJ3J6pam

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Polkadot to 153iRH61nXQZUXMveZxCmYyzjf1cWYVnxpHpfifoNchQuXbY

Donate Polkadot to this address

Scan the QR code or copy the address below into your wallet to send some Polkadot

Scan to Donate Binance coin to bnb14ye5rju74u5ythneaum2rjvp8eqep6wq8flghx

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Litecoin to LfNfer3aSqLx4p8KfbbkT96ArXLXLDPxoD

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Bitcoin cash to qrc7scd2drzsd7kywpsjfklvkmm26fqc2vd7uyvdx9

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Dogecoin to DCwbNzfYHx22MDSyEVLWgfjxziYHtcgwAM

Donate Dogecoin to this address

Scan the QR code or copy the address below into your wallet to send some Dogecoin

Scan to Donate Tron to TL1Q3vY9mHnDMedHRyU8ERUAY8SzJ4FXiV

Donate Tron to this address

Scan the QR code or copy the address below into your wallet to send some Tron

Scan to Donate Monero to 45qwFr42XiA8egC5z2HdSQ2FzzP9VR1MvD5Sicg4EhGvdvTutx9GsF6DeU8DHAsTZy2ShBERjCB5rdy8iQ9CFnFu9Z6Adgw

Donate Monero to this address

Scan the QR code or copy the address below into your wallet to send some Monero

Scan to Donate Omisego to 0x162fc7781D3C6c6f27197A3A92567b5DAF258f19

Donate Omisego to this address

Scan the QR code or copy the address below into your wallet to send some Omisego

Published inGamingMinecraft

11 Comments

  1. Khaossa Khaossa

    Install all made as yo u have explained and unexpected close in less than a minute. I have a DSM7 and DS720+

    • Dr_Frankenstein Dr_Frankenstein

      Are you getting an error in the logs at all?

    • Dr_Frankenstein Dr_Frankenstein

      Is there anything in the logs to say why it closed. Should be a tab in the container.

  2. Bengt Bengt

    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

    • Dr_Frankenstein Dr_Frankenstein

      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?

      • Bengt Bengt

        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.

  3. Andras Andras

    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!

    • Dr_Frankenstein Dr_Frankenstein

      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)

    • aroundonme aroundonme

      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.

      • Dr_Frankenstein Dr_Frankenstein

        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

  4. Just Just

    Thanks, it worked!!. Just one thing, I think this container is ignoring the PUID and GUID, it’s creating everyting with UID/GID 1000

Leave a Reply

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