Docker Compose Deployment Guide
This document provides detailed steps for deploying the MCPCan system using Docker Compose. This scheme is suitable for local development, testing, and lightweight production environments.
1. Get Code
First, you need to clone the project code to your local server or development machine.
# Clone the deployment repository
git clone https://github.com/kymo-mcp/mcpcan-deploy.git
# Enter the Docker Compose deployment directory
cd mcpcan-deploy/docker-compose/Note: Ensure that Git, Docker (20.10.0+), and Docker Compose (v2.0.0+) are installed on your machine.
2. Environment Configuration
Before starting the service, you need to configure environment variables according to your network environment.
2.1 Initialize Configuration File
Copy the example environment file example.env to .env:
cp example.env .env2.2 Switch Image Registry (CN/Global)
To accelerate image pulling, you can configure the image registry prefix in the .env file based on your region.
Open the .env file with a text editor (such as vim or nano):
vim .envFind the REGISTRY_PREFIX configuration item:
China Users (Recommended): Use the Tencent Cloud mirror registry by uncommenting the following lines:
bash# Option 2: China Mirror Registry (Uncomment to use) REGISTRY_PREFIX=ccr.ccs.tencentyun.com/itqm-private # Remember to comment out Option 1 # REGISTRY_PREFIX=77kymoGlobal Users: Use Docker Hub (Global), keep the default or use the following configuration:
bash# Option 1: Global Registry (Default) REGISTRY_PREFIX=77kymo # Option 2 commented out # REGISTRY_PREFIX=ccr.ccs.tencentyun.com/itqm-private
2.3 Generate Final Configuration
Run the configuration generation script. This script reads variables from .env (including the registry source and ports you just set) and generates the final docker-compose configuration file based on templates.
# Add execution permission
chmod +x replace.sh
# Execute generation script
./replace.shImportant: If you modify the
.envfile later (e.g., changing ports or passwords), you MUST re-run./replace.shfor changes to take effect.
3. Start Services
Execute the following command to start all services:
docker compose up -dThe first startup will automatically pull images and perform database initialization. The startup process usually includes the following stages:
- Basic Services: MySQL and Redis start.
- Initialization: The
mcp-initcontainer runs and executes database migrations. - Core Services: After
mcp-initexits successfully, services likemcp-authzandmcp-marketstart. - Gateway Entry: Finally,
traefikandmcp-webstart to provide external access.
Access Addresses:
- HTTP: http://localhost (Default port 80)
- HTTPS: https://localhost (Default port 443)
4. Common Maintenance Commands
Update and Restart
When you modify the configuration or need to update the image version:
# 1. Pull the latest image
docker compose pull
# 2. Recreate containers (run ./replace.sh first if config changed)
docker compose up -dView Logs
Very useful commands for troubleshooting:
# View all logs
docker compose logs -f
# View initialization logs (check this first if services don't start)
docker compose logs mcp-init5. Cleanup and Uninstall
If you need to completely remove MCPCan installation traces, follow these steps.
5.1 Stop Services and Clean Containers
Stop all running containers and remove networks:
docker compose down5.2 Clean Data (Use with Caution)
Warning: This operation will permanently delete database data (MySQL), Redis data, and all uploaded files.
# Delete the data folder in the current directory
rm -rf ./data5.3 Clean Images
Delete unused old images to free up disk space:
docker image prune -fOr delete all related images (specify image name manually or use filter):
# Delete all mcpcan related images (example)
docker images | grep mcpcan | awk '{print $3}' | xargs docker rmi