先创建一个文件夹用来执行存放相关文件 例如 mc
创建docker-compose文件 touch docker-compose.yml
写入一下内容
version: "3.8"
services:
mc:
image: itzg/minecraft-server:latest
container_name: mc
tty: true
stdin_open: true
restart: unless-stopped
ports:
- "25565:25565"
environment:
- EULA=TRUE
- ONLINE_MODE=FALSE
- MAX_PLAYERS=5
- DIFFICULTY=hard
#- MEMORY=2G
#- VERSION=1.8.2
- MOTD="A §l§cMinecraft§r §nserver"
- TYPE=CUSTOM
#- CUSTOM_SERVER=paper-1.20.4-381.jar
- CUSTOM_JAR_EXEC=-jar paper-1.20.4-381.jar
#- ENABLE_COMMAND_BLOCK=true
#JVM_OPTS: "-someJVMOption someJVMOptionValue"
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
MC 启动 输入 dockerp-compse up -d
上面是最基础的内容,下面开始自定义吧
官方文档
支持一下