简体   繁体   English

重新连接到 Docker 容器中运行的 bash

[英]Reconnect to running bash in Docker Container

I am not much of a docker expert but i managed to start my python scirpt in a docker bash.我不是 docker 专家,但我设法在 docker bash 中启动了我的 python 脚本。 After connection errors with the network I loose my connection to the ubuntu server where the docker is running on.在网络连接错误后,我失去了与运行 docker 的 ubuntu 服务器的连接。 After reconnect to the server, I can still connect to the docker container which is still running, but I am not able to connect to the bash where my Python script is running in. So, how to reconnect to the docker containers bash where my script is running in, to see its progress?重新连接到服务器后,我仍然可以连接到仍在运行的 docker 容器,但是我无法连接到运行我的 Python 脚本的 bash。那么,如何重新连接到我的脚本所在的 docker 容器 bash正在磨合,看看它的进展?

使用 docker logs (documents) *您将无法使用这种方式来结束 python

as a general rule there is no way to "recover" a lost bash session.作为一般规则,没有办法“恢复”丢失的 bash 会话。

A workaround could be to run a script inside a terminal multiplexer like screen or tmux , which allows you to attach / recover the session from multiple terminals.一种解决方法是在终端多路复用器(如screentmux运行脚本,这允许您从多个终端附加/恢复会话。

I fear the current process is gone, you can only check the logs using docker logs , but chances are your job died with your session (unless you nohup ed it).我担心当前进程已经消失,您只能使用docker logs检查docker logs ,但是您的工作很可能因会话而死亡(除非您nohup编辑它)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM