# 1. 系统编译工具
yum install gcc gcc-c++ python36-devel -y
# 2. 清理冲突socketio包
pip3 uninstall flask-socketio python-socketio eventlet greenlet -y
# 3. 安装基础依赖
pip3 install flask docker --user
# 4. docker权限
usermod -aG docker root
newgrp docker
# 5. 验证docker连通
python3 -c "import docker;cli=docker.DockerClient();print('Docker连接正常')"
# 6. 后台启动服务
nohup python3 /opt/alert_dashboard/www/api/docker_api.py > /opt/alert_dashboard/www/api/docker_api.log 2>&1 &
# 7. 防火墙放行端口
firewall-cmd --add-port=8090/tcp --permanent
firewall-cmd --reload
# 8. 查看运行状态
sleep 2
ps aux | grep docker_api.py
tail -n 20 /opt/alert_dashboard/www/api/docker_api.log