rxr_docker_compose/rxr_mc/docker-compose.yaml
2024-12-31 12:40:48 +08:00

21 lines
617 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
minecraft:
image: openjdk:17-jdk-slim # 使用 JRE 版本的镜像
container_name: minecraft-server
working_dir: /mc-server
environment:
- TZ=Asia/Shanghai
volumes:
- ${MC_DIR}:/mc-server
command: >
java -Xmx7G -jar ${JAR_FILE} nogui
ports:
- "25565:25565"
stdin_open: true
tty: true
restart: always
mem_limit: 10G # 设置容器的内存限制为 10GB
memswap_limit: 10G # 禁止使用 swap并确保总内存不超过 10GB
# oom_score_adj: -1000
stop_grace_period: 120s # 设置关闭宽限期为 120 秒