Docker Deployment
Prerequisites
MaiBot Docker deployment requires Docker and Docker Compose, plus at least 2GB of available memory. It supports Linux, macOS, and Windows (via Docker Desktop).
First, verify your environment:
docker --version
docker compose versionIf not installed yet, refer to the official docs:
- Docker — Official Installation Docs
- Docker Compose — Official Installation Docs
Domestic Users (China)
For servers in China, you can use this one-liner:
bash <(curl -sSL https://linuxmirrors.cn/docker.sh)Docker Compose
This is the recommended deployment method.
Using the Official docker-compose.yml
The MaiBot repository provides a complete docker-compose.yml. Download it directly:
curl -o docker-compose.yml https://raw.githubusercontent.com/Mai-with-u/MaiBot/main/docker-compose.ymlwget -O docker-compose.yml https://raw.githubusercontent.com/Mai-with-u/MaiBot/main/docker-compose.ymlThe official configuration includes MaiBot core, NapCat, and database tools, suitable for most users.
Using the Minimal Configuration
If you only need the MaiBot core without NapCat and database tools, use this minimal configuration:
services:
core:
container_name: maim-bot-core
image: sengokucola/maibot:latest
environment:
- TZ=Asia/Shanghai
- EULA_AGREE=8e6e7d647f7f82d6ea98456b73908656
- PRIVACY_AGREE=91e5db7659c560bc3545e63859b6ebc0
- WEBUI_HOST=0.0.0.0
ports:
- "18001:8001"
volumes:
- ./docker-config/mmc:/MaiMBot/config
- ./data/MaiMBot:/MaiMBot/data
- ./data/MaiMBot/plugins:/MaiMBot/plugins
- ./data/MaiMBot/logs:/MaiMBot/logs
restart: alwaysStart
docker compose up -dThe first launch will automatically generate configuration files.
Data Storage Locations
- Configuration files —
./docker-config/mmc/ - Runtime data —
./data/MaiMBot/ - Plugins —
./data/MaiMBot/plugins/ - Logs —
./data/MaiMBot/logs/
Port Reference
- WebUI — 18001 (mapped to 8001 inside the container)
WARNING
The default WebUI host is 127.0.0.1, which inside a Docker container means only the container itself can access it. When deploying with Docker, make sure to change host to 0.0.0.0.
TIP
If your server has the standalone Docker Compose installed, the command should be docker-compose (with a hyphen) instead of docker compose.
Direct Docker Image Deployment
If you just want to quickly pull and run the image without modifying any configuration, use this method:
docker pull sengokucola/maibot:latestThen run the container directly:
docker run -d \
--name maim-bot-core \
-p 18001:8001 \
-e TZ=Asia/Shanghai \
-e EULA_AGREE=8e6e7d647f7f82d6ea98456b73908656 \
-e PRIVACY_AGREE=91e5db7659c560bc3545e63859b6ebc0 \
-e WEBUI_HOST=0.0.0.0 \
-v ./docker-config/mmc:/MaiMBot/config \
-v ./data/MaiMBot:/MaiMBot/data \
-v ./data/MaiMBot/plugins:/MaiMBot/plugins \
-v ./data/MaiMBot/logs:/MaiMBot/logs \
--restart always \
sengokucola/maibot:latestThis method only starts the MaiBot core. If you also need NapCat and database tools, use Docker Compose deployment instead.
Building from Source with Docker
If you need to modify the source code, or cannot pull images directly from Docker Hub, you can build locally:
git clone https://github.com/Mai-with-u/MaiBot.gitEnter the folder and build the image:
docker build -t maibot .To run the container, the command is the same as direct image deployment, just replace the image name with the locally built maibot:
docker run -d \
--name maim-bot-core \
-p 18001:8001 \
-e TZ=Asia/Shanghai \
-e EULA_AGREE=8e6e7d647f7f82d6ea98456b73908656 \
-e PRIVACY_AGREE=91e5db7659c560bc3545e63859b6ebc0 \
-e WEBUI_HOST=0.0.0.0 \
-v ./docker-config/mmc:/MaiMBot/config \
-v ./data/MaiMBot:/MaiMBot/data \
-v ./data/MaiMBot/plugins:/MaiMBot/plugins \
-v ./data/MaiMBot/logs:/MaiMBot/logs \
--restart always \
maibotAccessing WebUI
After starting, MaiBot automatically launches the WebUI service. Open your browser and visit the following address (replace 本机IP with your server address; use localhost if running locally):
http://本机IP:18001On first launch, the container log will print the WebUI login Token, like this:
07-30 18:53:45 [WebUI] WebUI 配置文件不存在,正在创建: /MaiMBot/data/webui.json
07-30 18:53:45 [WebUI] WebUI 配置已保存到: /MaiMBot/data/webui.json
07-30 18:53:45 [WebUI] 新的 WebUI Token 已生成: QSwgc2Vu...
07-30 18:53:45 [WebUI应用] 🔑 WebUI 登录 Token: 5YWz5rOo5Y+v5LmQ5Za1fiDlhbPms6jlj6/kuZDosKLosKLllrXvvIE=
07-30 18:53:45 [WebUI应用] 💡 请使用此 Token 登录 WebUI
07-30 18:53:45 [WebUI服务] 🌐 WebUI 服务器启动中...Use this command to view container logs:
docker compose logs coreCopy the Token from the log and paste it into the browser login page to access WebUI. You can later view or modify the Token in data/webui.json.
Once in WebUI, follow the configuration wizard to set up models and connect platforms.
For detailed steps on configuring models and connecting QQ, refer to Model Configuration and Adapters.