2024-11-02 13:08:38 +00:00
|
|
|
services:
|
|
|
|
minecraft:
|
2024-11-15 08:28:00 +00:00
|
|
|
image: openjdk:17
|
2024-11-02 13:08:38 +00:00
|
|
|
container_name: minecraft-server
|
|
|
|
working_dir: /mc-server
|
|
|
|
environment:
|
|
|
|
- MAX_MEMORY=${MAX_MEMORY}
|
|
|
|
- MIN_MEMORY=${MIN_MEMORY}
|
|
|
|
- TZ=Asia/Shanghai
|
|
|
|
volumes:
|
|
|
|
- ${MC_DIR}:/mc-server
|
|
|
|
command: >
|
2024-11-14 08:11:05 +00:00
|
|
|
java -Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -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 -jar ${JAR_FILE} nogui
|
2024-11-02 13:08:38 +00:00
|
|
|
ports:
|
|
|
|
- "25565:25565"
|
|
|
|
stdin_open: true
|
|
|
|
tty: true
|
2024-11-10 09:01:51 +00:00
|
|
|
restart: always
|
2024-11-18 04:05:22 +00:00
|
|
|
memswap_limit: 10G
|
|
|
|
mem_limit: 10G
|
2024-11-13 07:05:15 +00:00
|
|
|
# java -Xmx${MAX_MEMORY} -Xms${MIN_MEMORY} -jar ${JAR_FILE} nogui
|
2024-11-10 09:01:06 +00:00
|
|
|
# mem_limit: 11g
|
|
|
|
# memswap_limit: 11g # 禁止使用 swap
|