A Docker-based chess.com bot powered by Selenium WebDriver and the Stockfish chess engine.
- ✅ Runs either in Docker or locally on the host system
- ✅ Simple configuration (see available options in
config.env) - ✅ Fully or partially automated (depending on configuration)
- ✅ Supported on Windows 10/11 and Linux (tested on Ubuntu 24.04)
- Persistent browser profiles when
STARTUP_TYPE=docker
Below is an overview of the supported environment variables defined in config.env:
-
STARTUP_TYPE:local|docker
Determines whether the bot runs locally or inside Docker. -
ELO_RATING: Integer ≥ -1
IfELO_RATING <= 0, Stockfish will not limit its ELO. -
FIRST_MOVE_W:
The opening move played when the bot has the white pieces. -
GAME_TIMER_MS:
Game timer in milliseconds. Only affects maximum move delay.
Ignored ifENABLE_MOVE_DELAY=False. -
GAME_TYPE:
One of:1min | 1+1 | 2+1 | 3min | 3+2 | 5min | 10min | 15+10 | 30min | random_leq5min | random_leq10minrandom_leq5min/random_leq10minselects a random mode up to blitz/rapid.GAME_TIMER_MSis not adjusted automatically when using random modes.
-
ENABLE_MOVE_DELAY:True|False
Enables realistic move delays.
IfFalse, the bot plays as fast as possible. -
AUTOSTART_FIRST_GAME:True|False
Automatically starts the first game.
⚠️ Cannot log into a chess.com account if enabled.
-
NUM_REPLICAS: Positive integer
Number of Docker replica containers to start. -
REPLICA_PORTS:
Must matchNUM_REPLICAS:- Single replica → single port (e.g.,
7910) - Multiple replicas → port range (e.g.,
7911-7914for 4 replicas)
- Single replica → single port (e.g.,
-
CHROMIUM_SCREEN_WIDTH/CHROMIUM_SCREEN_HEIGHT:
Chromium window dimensions (only relevant whenSTARTUP_TYPE=docker). -
SELENIUM_NODE_IDLE_TIMEOUT_SECONDS:
Idle timeout in seconds.
The Chrome session restarts after inactivity or a crash. -
OPEN_BROWSER:True|False
Automatically opens VNC URLs in the host's default browser.
Opens multiple tabs ifNUM_REPLICAS > 1.
-
Install Docker and Docker Compose
-
Set
STARTUP_TYPE=dockerinconfig.env -
Run the main script:
./main.sh
or on Windows:
./main.ps1On Linux, root authentication may be required to access the Docker daemon.
-
If
OPEN_BROWSER=True, the browser opens automatically once Selenium nodes are initialized. -
If
AUTOSTART_FIRST_GAME=True, the first game starts automatically. Otherwise, start it manually. -
To stop the bot:
./main.<sh/ps1> stop
or
./main.<sh/ps1> kill
⚠️ The local setup may result in unexpected issues depending on your host system.
Docker is recommended for maximum stability.
- Install Python >=3.10. Add Python to system PATH.
- Set
STARTUP_TYPE=localinconfig.env. - Make sure the
STOCKFISH_URLmatches your OS and architecture. - Run:
or:
./main.sh
./main.ps1- Note that the first startup may take more time, because Selenium will have to pull the Chromium driver if it is not installed.
- To stop the bot:
- Terminate the process in the terminal, or
- Close the browser window.
This software is provided as is, without warranty of any kind.
The author is not responsible for any adverse effects resulting from its use, including but not limited to account bans.