docker-minecraft-server: Can't use RCON

Hi I’m trying to execute commands using RCON on my server, but it doesn’t seem to work or even start at all. My server works fine. When I run docker exec mc-enigmatica rcon-cli op myname it returns Failed to connect to RCON serverdial tcp 127.0.0.1:25575: connect: connection refused

I tried exposing RCON ports to the outside and connect using some other tools like mcrcon, but it gives the same message.

My start script:

docker run -d \
-v /root/minecraft:/data \
-v /root/minecraft/mod:/modpacks \
-e TYPE=CURSEFORGE \
-e CF_SERVER_MOD=/modpacks/Enigmatica2Server-1.74b.zip \
-p 25565:25565 \
-p 25575:25575 \
-e EULA=TRUE \
-e ENABLE_RCON=true \
-e RCON_PASSWORD=testing \
-e ONLINE_MODE=FALSE \
-e 'MOTD=My server' \
-e MEMORY=3500M \
--name mc-enigmatica itzg/minecraft-server

I am using not an up to date modpack version and the RCON was working on other modpack (Valhelsia2), but hopefully that isn’t the issue with version, because I don’t want to change it.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 37 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I need to document it better, but the default password is actually “minecraft”, defined at

https://github.com/itzg/docker-minecraft-server/blob/de866a322ffc55e93c27d055efe4937d58bc19ba/Dockerfile#L71

The cool thing about docker exec is that it will borrow the env vars (including -e’s) from the container. You can docker exec CONTAINER env to confirm that.

So, RCON_PASSWORD should be picked up by an exec of rcon-cli as long as you made sure to change it via a -e. (If you change that after initial container creation, you’ll also need to set -e OVERRIDE_SERVER_PROPERTIES=true to keep the properties in sync with env vars.)

FYI, rcon-cli is programmed to pick up config from RCON_* env vars:

https://github.com/itzg/rcon-cli/blob/ef0727479c9ccf37ffdef2ed929e0e51402c97da/cmd/root.go#L96-L97

@taeraeyttaejae can you open up a new issue and include your compose file there?

@kevinkjt2000 , in the latest image that base directory can be configured via CF_BASE_DIR or FTB_BASE_DIR. Added a README section:

https://github.com/itzg/docker-minecraft-server#modpack-data-directory

This issue has been automatically closed because there has been no response after requesting feedback. Please feel free to re-open this issue if the scenario still exists and provide a comment with more information.