-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the problem
I have a small minecraft world that I play in survival and SPAWN_MONSTERS false with my kids. Recently, we started the server again and were pretty surprised when suddenly a monster spawned! Daddy saved the world, kids are fine but afterwards I went digging. It turns out that the minecraft release 25w35a has an important change:
Removed server property spawn-monsters in favour of new game rule
Thus, the existing logic to turn the SPAWN_MONSTERS environment variable into a value in server.properties doesn't work anymore.
I now use the rcon startup as a workaround:
environment:
RCON_CMDS_STARTUP: |-
gamerule minecraft:spawn_monsters false
which shows a change in the log:
[mc] | [18:30:58] [Server thread/INFO]: RCON running on 0.0.0.0:25575
[mc] | [Rcon loop] MCServer is listening, running startup
[mc] | [Rcon loop] running - gamerule minecraft:spawn_monsters false
[mc] | [18:31:01] [RCON Listener #1/INFO]: Thread RCON Client /0:0:0:0:0:0:0:1 started
[mc] | [18:31:01] [Server thread/INFO]: [Rcon: Gamerule spawn_monsters is now set to: false]
[mc] | [18:31:01] [RCON Client /0:0:0:0:0:0:0:1 #2/INFO]: Thread RCON Client /0:0:0:0:0:0:0:1 shutting down
[mc] | [Rcon loop] Gamerule spawn_monsters is now set to: false
[mc] | [Rcon loop] No addition rcon commands are given, stopping rcon cmd service
Now I'll need some time alone to double-check in-game that the monsters are indeed gone ;-)
Container definition
# https://docker-minecraft-server.readthedocs.io/
services:
mc:
image: docker.io/itzg/minecraft-server
environment:
EULA: "true"
# TYPE: "PAPER"
SPAWN_MONSTERS: "false"
ports:
- "25565:25565"
volumes:
- /containers/macht.org/minecraft:/data
# follow the advice in https://github.com/itzg/mc-image-helper/issues/498 to configure IPv6
# as described here: https://docs.docker.com/engine/daemon/ipv6/
networks:
ip6net:
enable_ipv6: true
ipam:
config:
- subnet: 2001:db8::/64
Container logs
Original log showed that server.properties is generated:
[mc] | [init] Running as uid=1000 gid=1000 with /data as 'drwxr-xr-x 12 1000 1000 4096 Jan 18 13:14 /data'
[mc] | [init] Image info: buildtime=2026-01-13T02:57:01.149Z,version=java25,revision=0a98bee40ea9b86500ea7b6611784902a553803f
[mc] | [init] Starting RCON commands
[mc] | [init] Rcon cmds functionality enabled
[mc] | [init] Resolving type given VANILLA
[mc] | [init] Resolved version given LATEST into 1.21.11
[mc] | [init] Copying any configs from /config to /data/config
[mc] | [mc-image-helper] 18:33:19.482 INFO : Created/updated 1 property in /data/server.properties
[mc] | [init] Setting initial memory to 1G and max to 1G
[mc] | [init] Starting the Minecraft server...
[mc] | Starting net.minecraft.server.Main
In-game we saw monsters, though...