rcon-cli is a command-line tool bundled with the itzg/minecraft-server image that provides CLI access to RCON (Remote Console) endpoints. It enables you to send commands to the Minecraft server without needing to attach to the console.
Version: 1.7.3
Repository: itzg/rcon-cli
Repository: itzg/rcon-cli
Overview
RCON (Remote Console) is enabled by default in the itzg/minecraft-server image, allowing you to execute commands remotely. Thercon-cli tool provides a simple interface for interacting with the server console.
Usage
Interactive Mode
To access the Minecraft server console interactively:Ctrl+D or by typing quit.
One-Shot Commands
To execute a single command without entering interactive mode, pass the command as arguments:The
-i flag is not needed for one-shot commands.Common Commands
Server Management
Player Management
World Management
Configuration
rcon-cli automatically connects to the RCON port configured in your server. By default, it uses:
- Host: localhost
- Port: 25575 (default RCON port)
- Password: Value from
RCON_PASSWORDenvironment variable
Environment Variables
You can customize RCON configuration through these environment variables:RCON_PORT- Change the RCON port (default: 25575)RCON_PASSWORD- Set the RCON password (randomly generated by default)ENABLE_RCON- Enable/disable RCON (default: true)
When RCON is Disabled
If you disable RCON withENABLE_RCON=false, you can still send commands using the mc-send-to-console script:
CREATE_CONSOLE_IN_PIPE=true to enable console pipe functionality.
Advanced Usage
With Docker Compose
In a Docker Compose setup:Scripting
You can usercon-cli in scripts for automation:
Multiple Commands
Execute multiple commands in sequence:Troubleshooting
Authentication Failed
If you get authentication errors:- Check that RCON is enabled (
ENABLE_RCON=true) - Verify the RCON password is correct
- Check the RCON port is correct (default 25575)
Connection Refused
Ifrcon-cli cannot connect:
- Ensure the server is fully started
- Check that RCON is enabled in server configuration
- Verify the RCON port is not blocked
Command Not Found
If you get “command not found”:- The
rcon-clitool is only available inside the container - Always use
docker execto run it
Related Commands
See also:- mc-monitor - Server monitoring and health checks
- mc-image-helper - Server setup and configuration