#!/usr/bin/env python3
"""
检查Docker容器的数据卷映射
确认容器能否访问赵云的数据
"""

import subprocess
import sys

def main():
    print("🔍 检查Docker容器数据卷映射")
    print("="*60)
    
    # 检查容器信息
    print("1. 检查 sanguo_vnpy 容器...")
    cmd = "docker inspect sanguo_vnpy | grep -A 10 'Mounts'"
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
    print(result.stdout)
    
    # 检查容器内能否访问数据
    print("\n2. 检查容器内能否访问数据库...")
    check_cmd = '''
    docker exec sanguo_vnpy bash -c "
        ls -la /app/data/ 2>/dev/null || echo '/app/data/ 不存在'
        ls -la /Users/chufeng/ 2>/dev/null || echo '/Users/chufeng/ 不存在'
        ls -la /host/workspace-zhaoyun/zhaoyun-data/data/ 2>/dev/null || echo 'host/workspace-zhaoyun 不存在'
    "
    '''
    result = subprocess.run(check_cmd, shell=True, capture_output=True, text=True)
    print(result.stdout)
    
    print("\n" + "="*60)
    print("💡 需要确认:")
    print("1. 数据库文件在主机: /Users/chufeng/.openclaw/workspace-zhaoyun/zhaoyun-data/data/database_test.db")
    print("2. 需要确保Docker容器映射了这个路径")
    print("3. 如果没有映射，需要重新启动容器或配置")
    print("="*60)

if __name__ == "__main__":
    main()