63 lines
1.6 KiB
Plaintext
63 lines
1.6 KiB
Plaintext
|
|
===========================================
|
|||
|
|
Docker SSH 连接 - 问题已解决
|
|||
|
|
===========================================
|
|||
|
|
|
|||
|
|
✅ 问题已成功解决!
|
|||
|
|
|
|||
|
|
【连接信息】
|
|||
|
|
-----------
|
|||
|
|
公网 IP: 36.139.241.152
|
|||
|
|
SSH 端口: 12266
|
|||
|
|
用户名: root
|
|||
|
|
密码: Aa@123456
|
|||
|
|
|
|||
|
|
【连接命令】
|
|||
|
|
-----------
|
|||
|
|
ssh -p 12266 root@36.139.241.152
|
|||
|
|
|
|||
|
|
【问题总结】
|
|||
|
|
-----------
|
|||
|
|
问题: SSH连接后立即断开
|
|||
|
|
原因: Docker容器缺少PTY(伪终端)管理权限
|
|||
|
|
解决: 使用 --privileged 参数重建容器
|
|||
|
|
|
|||
|
|
【持久化配置】
|
|||
|
|
-------------
|
|||
|
|
所有配置文件已创建在项目中:
|
|||
|
|
- docker-compose.yml (Docker Compose配置)
|
|||
|
|
- docker/start-ssh.sh (SSH启动脚本)
|
|||
|
|
- docker/run-ssh-container.sh (快速启动脚本)
|
|||
|
|
- docker/Dockerfile.ssh (SSH镜像构建文件)
|
|||
|
|
- SSH_SETUP_GUIDE.md (详细使用指南)
|
|||
|
|
|
|||
|
|
详细使用说明请查看: SSH_SETUP_GUIDE.md
|
|||
|
|
|
|||
|
|
【快速重启容器】
|
|||
|
|
--------------
|
|||
|
|
方法1 - Docker Compose:
|
|||
|
|
docker-compose up -d
|
|||
|
|
|
|||
|
|
方法2 - 启动脚本:
|
|||
|
|
./docker/run-ssh-container.sh
|
|||
|
|
|
|||
|
|
方法3 - 手动命令:
|
|||
|
|
docker stop bevfusion_ssh && docker rm bevfusion_ssh
|
|||
|
|
docker run -d --name bevfusion_ssh --privileged -p 12266:22 \
|
|||
|
|
-v $(pwd)/docker/start-ssh.sh:/start-ssh.sh:ro \
|
|||
|
|
-v /workspace:/workspace \
|
|||
|
|
-v /data:/data \
|
|||
|
|
--restart unless-stopped \
|
|||
|
|
localhost/bevfusion:ssh /bin/bash /start-ssh.sh
|
|||
|
|
|
|||
|
|
【挂载目录】
|
|||
|
|
-----------
|
|||
|
|
- /workspace → 容器内 /workspace (代码和项目文件)
|
|||
|
|
- /data → 容器内 /data (数据集和模型)
|
|||
|
|
|
|||
|
|
【验证成功】
|
|||
|
|
-----------
|
|||
|
|
2025-10-16 测试通过
|
|||
|
|
连接成功,交互式shell正常工作
|
|||
|
|
|
|||
|
|
===========================================
|