Skip to content

jusito/docker-ftb-alpine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft modpacks meet alpine

This repository contains servers for minecraft modpacks like FTB: Build Status

By using this container you agree to the Minecraft Eula

Getting Started

  1. Which server you want? Which version you want? Choose you Tag below like DungeonsDragonsAndSpaceShuttles-7.4a-1.12.2
  2. Which Port? -p 25566:25565 means 25566 from internet, 25565 from inside of container
  3. Do you want default jvm arguments / RAM usage and so on? Yes go next, no see Environment Variables
  4. Should I enter an operator level 4? He would be also whitelisted. No go next, yes use -e ADMIN_NAME="YourNameHere"
  5. Do you want your own server.properties? No go next, yes see Environmental Variables, server.properties or see Additional Informations

Example Dungeons Dragons And Space Shuttles:

docker run -d -p 25565:25565 -v minecraft:/home/docker:rw -e ADMIN_NAME="YourNameHere" -e motd="Hello Docker" jusito/docker-ftb-alpine:DungeonsDragonsAndSpaceShuttles-7.4a-1.12.2

Tags

There are two different base images which provides different java virtual machine. The alpine images are amd64/x86 with Hotspot jvm as default (like expected) and openj9 is an option, multiarch isn't supported. I test every modpack with openj9 but if it doesn't even start the server, I will not push a tag with it. (forge with 1.15+ will throw unsupported virtual machine for openj9) Every tag is tested before push but this tags are more example configurations of the base images. Every provided tag will use the recommended server properties and forge version from modpack creator - if not its a bug and please report it. If you want to use the nightly images append "-develop" to the tag.

most recent

other

no Tag found?

  • Tag: 8jre-alpine-hotspot or 8jre-alpine-openj9 (unsure -> pick hotspot!)
  • First argument: Link to server download
  • Second argument: MD5 of server download
  • You are done

Example: docker run [...] jusito/docker-ftb-alpine:8jre-alpine-hotspot "https://media.forgecdn.net...server.zip" "*md5 of server*"

Environment Variables

Example: docker [...] -e JAVA_PARAMETERS="-Xms4G -Xmx4G" [...] jusito/docker-ftb-alpine:*TAG*

JAVA_PARAMETERS (JVM Arguments, Performance)

  • default for hotspot -Xms4G -Xmx4G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCGroupMemoryLimitForHeap
  • default for openj9 -Xms4096M -Xmx4096M -Xmns2048M -Xmnx3276M -Xgc:concurrentScavenge -Xgc:dnssExpectedTimeRatioMaximum=3 -Xgc:scvNoAdaptiveTenure -Xdisableexplicitgc -Xtune:virtualized
  • reddit suggestion, good for clients -XX:+UseG1GC -Xmx4G -Xms4G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
  • aikar suggestion: link
  • Iam using for DDSS server: -Xms8192M -Xmx8192M -XX:+UseStringDeduplication -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true

Server Properties

Because you may want to use many environment variables, you may find --env-file helpful. The values of this environment variables are written on every restart. If you don't set them, default value is written.

Name Default Description
OVERWRITE_PROPERTIES true server.properties are deleted and rewritten at each restart. Unused variables remain on default. Unknown properties are deleted.

In general Propertyname = Variablename, lowercase and replace "-"&"." with "_". See below for details.

All Available Properties (click me)

Name Default Name in server.properties
allow_flight false allow-flight
allow_nether true allow-nether
broadcast_console_to_ops true broadcast-console-to-ops
difficulty 1 difficulty
enable_command_block false enable-command-block
enable_jmx_monitoring false enable-jmx-monitoring=false
enable_query false enable-query
enable_rcon false enable-rcon
enable_status true enable-status
enforce_whitelist false enforce-whitelist
entity_broadcast_range_percentage 100 entity-broadcast-range-percentage
force_gamemode false force-gamemode
function_permission_level 2 function-permission-level
gamemode 0 gamemode
generate_structures true generate-structures
generator_settings generator-settings
hardcore false hardcore
level_name world level-name
level_seed level-seed
level_type DEFAULT level-type
max_build_height 256 max-build-height
max_players 20 max-players
max_tick_time 60000 max-tick-time
max_world_size 29999984 max-world-size
motd A Minecraft Server
network_compression_threshold 256 network-compression-threshold
online_mode true online-mode
op_permission_level 4 op-permission-level
player_idle_timeout 0 player-idle-timeout
prevent_proxy_connections false prevent-proxy-connections
pvp true pvp
query_port 25565 query.port
rate_limit 0 rate-limit
rcon_password rcon.password
rcon_port 25575 rcon.port
resource_pack resource-pack
resource_pack_sha1 resource-pack-sha1
server_ip server-ip
server_port 25565 server-port
snooper_enabled true snooper-enabled
spawn_animals true spawn-animals
spawn_monsters true spawn-monsters
spawn_npcs true spawn-npcs
spawn_protection 16 spawn-protection
sync_chunk_writes true sync-chunk-writes
view_distance 10 view-distance
white_list false white-list

access server console

docker exec -it CONTAINER query

  • show - view last 50 log lines
  • end - end query
  • help - call help in serverquery
  • stop - call stop in serverquery
  • *every other serverquery command*

Healthcheck

This container is using a health check default. It checks every 10s if the server status is available. If you don't want this use: --no-healthcheck

Name Default Description
HEALTH_URL 127.0.0.1 Target address for healthcheck. Maybe you want to add your external address.
HEALTH_PORT read from server.properties Target port for healthcheck.

additional config

Name Default Description
FORCE_DOWNLOAD false Whether the server should be downloaded every time it is restarted.
ADMIN_NAME Set here your first admin level 4 name. This will allow you to change config ingame.
DEBUGGING false If true xtrace is set in every script. Very verbose!
FORGE_VERSION Force forge version because this images always ignore the shipped forge jars (if not exact vesion configured for the image).

Internal Used (don't change please)

(click me)

Name Default Description
MY_USER_ID 10000
MY_GROUP_ID 10000
MY_NAME docker
MY_HOME /home/docker
MY_VOLUME /home/docker
MY_FILE TagDependency Name of the server file.
MY_SERVER TagDependency Download link of the server.
MY_MD5 TagDependency MD5 of Download.
TEST_MODE used for CI
STARTUP_TIMEOUT 600 timeout for TEST_MODE

Additional Informations

Volumes

  • /home/docker

Useful File Locations

  • /home/docker/config/ Mod configs
  • /home/docker/logs/ FTB logs
  • /home/docker/mods/ Mod folder
  • /home/docker/server.properties
  • /home/docker/config.sh your personal config
  • /home/addOp.sh script you can use for adding op.

add Operator

You can use the ingame command, if you don't like it: docker exec "CONTAINER" /home/addOp.sh "uuid" "name" "level" "bypassesPlayerLimit"

  • uuid can be empty, will be resolved
  • name is needed
  • level if unset 4
  • bypassesPlayerLimit if unset true
  • docker restart CONTAINER needed

Use your existing server.properties

  1. Step 1 & 2 can be done with copyToVolume.sh from tools section on git.
  2. Create a volume where "server.properties" is at root location.
  3. Set uid gid permissions on 10000.
  4. start container with volume and -e OVERWRITE_PROPERTIES=false

persistent files on update

  • banned-ips.json
  • banned-players.json
  • config.sh (if existing)
  • ops.json
  • server.properties
  • usercache.json
  • usernamecache.json
  • whitelist.json

cleared on update

  • mods/*
  • config/*
  • scripts/*
  • structures/*

migrate server

You can use copyToVolume.sh from tools section on git. Examples below will result in a ready to go volume named "NewMCVolume". Download copyToVolume.sh, script is ash / bash compatible and only needs docker, no bind mount perm. needed.

Migration current status Needed Command Result
Existing volume with your server files. Files are at VOLUME/server.properties Name of the volume, MyMCVolume. bash copyToVolume.sh MyMCVolume volume NewMCVolume 10000 10000 NewMCVolume is ready to go
Existing folder at host. Files are at FOLDER/server.properties Path to the folder, /home/jusito/MCServer/server.properties. bash copyToVolume.sh '/home/jusito/MCServer/*' path NewMCVolume 10000 10000 NewMCVolume is ready to go

Own Scripts

  • /home/docker/config.sh, care because only alpine + busybox, no Bash, no PCRE

Minecraft related

Resources needed / Problem resolve

4GB RAM and 4 CPUs with lower priority should be enough on a small server. In general you should set a container limit for CPU / RAM. --memory="4096m" --cpu-shares=1024 --cpus=4 --blkio-weight 125 If you use this, with the help of OpenJDK you can replace options like -Xmx4G -XX:ParallelGCThreads=5 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 with -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap OpenJDK Make JVM respect CPU and RAM limits OpenJDK will then make optimal use of the resources.

To understand whats wrong with your performance, you should know that the Garbage Collector (GC) in Java 8 stops everything if working. Thats because the default GC is for throughput not low latency, the default one in Java 8 is using only one thread for this. For example if you see lags ingame, like Mobs stopping for a second and are instant at your location, your problem is the GC. Java Low Latency If the lag occures like every second, you need more RAM -Xms -Xmx. If the lag isn't every second but very long, you want better multithreading for GC -XX:+UseParNewGC (FTB recommends this) or -XX:+UseG1GC (Oracle recommends this Oracle). This is basic stuff ofc there is a lot more, just search for "jvm low latency".

Is this working?

The label at the top of this document updates every week. If you want to test it on your own:

  1. Clone Repository & install shellcheck
  2. Navigate to root dir of repo
  3. [Optional] Create Dockerfile for your modpack, just copy another FTB Dockerfile (if jar see vanilla, if zip see others, twitch forge see RLCraft), replace download & md5
  4. bash test/testCaseQuick.sh "Vanilla-1.15.2" or bash test/testCaseAll.sh
  5. [Optional] If you want more details, export DEBUGGING=true (xtrace activated everywhere)

Hint: If you want to test Modpack A in Version B, Dockerfile should be at "modpacks/A/B/Dockerfile" and you can test it with bash test/testCaseQuick.sh "A-B". For A:=Vanilla and B:=1.15.2 this would be "modpacks/Vanilla/1.15.2/Dockerfile" and image name used for testing "Vanilla-1.15.2".

FTP Server

  • If your Volume is MyMinecraftVolume
  • If you didn't change UserID / GroupID
  • If you want to connect to ftp://...:123 (ports 122/123 are free on your network)

For FileZilla

docker run -d \
 -e MY_NAME="docker" -e MY_PASSWORD="MySecurePW" \
 -e MY_USER_ID="10000" -e MY_GROUP_ID="10000" \
 -p 122:20 -p 123:21 -p 10090-10100:10090-10100 \
 -v MyMinecraftVolume:/home/docker/ \
 jusito/vsftpd-alpine:simple

For Windows Network Mount

  • IP of the Host (not container) 1.2.3.4
  • Mount: ftp://1.2.3.4:123
docker run -d \
 -e MY_NAME="docker" -e MY_PASSWORD="MySecurePW" \
 -e MY_USER_ID="10000" -e MY_GROUP_ID="10000" \
 -p 122:20 -p 123:21 -p 10090-10100:10090-10100 \
 -v MyMinecraftVolume:/home/docker/ \
 -e pasv_address="1.2.3.4" \
 jusito/vsftpd-alpine:simple

Contributing / Requesting

Create a git issue or see maintainer label, I don't check everytime for newer version but I can easily push a new tag

Acknowledgments