Deploy AstrBot with Docker
Docker provides a convenient way to deploy AstrBot on Windows, Mac, and Linux.
This tutorial assumes you have Docker installed in your environment. If not, please refer to the Docker official documentation for installation.
Deploy with Docker Compose
::: details Deploy AstrBot Only (General Method)
First, clone the AstrBot repository to your local machine:
git clone https://github.com/AstrBotDevs/AstrBot
cd AstrBot
Then, run Compose:
sudo docker compose up -d
If your network environment is in mainland China, the above command will not pull properly. You may need to modify the compose.yml file and replace
image: soulter/astrbot:latestwithimage: m.daocloud.io/docker.io/soulter/astrbot:latest. :::
::: details Deploy with Agent Sandbox Environment
Supports native Python code execution, Shell code execution, and other features.
Deployment method:
git clone https://github.com/AstrBotDevs/AstrBot
cd AstrBot
# Modify the environment variable configuration in the compose-with-shipyard.yml file, such as Shipyard's access token, etc.
docker compose -f compose-with-shipyard.yml up -d
docker pull soulter/shipyard-ship:latest
For configuration and usage details, see the Agent Sandbox Environment documentation. :::
Deploy with Docker
mkdir astrbot
cd astrbot
sudo docker run -itd -p 7860:7860 -p 6199:6199 -v $PWD/data:/AstrBot/data -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --name astrbot soulter/astrbot:latest
If your network environment is in mainland China, the above command will not pull properly. Please use the following command to pull the image:
sudo docker run -itd -p 7860:7860 -p 6199:6199 -v $PWD/data:/AstrBot/data -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --name astrbot m.daocloud.io/docker.io/soulter/astrbot:latest(Thanks to DaoCloud β€οΈ)
No need to add sudo on Windows, same below Sync Host Time on Windows (requires WSL2)
-v \\wsl.localhost\(your-wsl-os)\etc\timezone:/etc/timezone:ro
-v \\wsl.localhost\(your-wsl-os)\etc\localtime:/etc/localtime:ro
View AstrBot logs with the following command:
sudo docker logs -f astrbot
π All Done
If everything goes well, you will see logs printed by AstrBot.
If there are no errors, you will see a log message similar to π Dashboard started, accessible at with several links. Open one of the links to access the AstrBot dashboard.
Since Docker isolates the network environment, you cannot use
localhostto access the dashboard.The default username and password are
astrbotandastrbot.If deployed on a cloud server, you need to open ports
6180-6200and11451in the cloud provider's console.
Next, you need to deploy any messaging platform to use AstrBot on that platform.