Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 当通过ssh连接时,如何在AWS实例的docker中保持进程运行_Amazon Web Services_Docker_Ssh_Nohup - Fatal编程技术网

Amazon web services 当通过ssh连接时,如何在AWS实例的docker中保持进程运行

Amazon web services 当通过ssh连接时,如何在AWS实例的docker中保持进程运行,amazon-web-services,docker,ssh,nohup,Amazon Web Services,Docker,Ssh,Nohup,我正在使用笔记本电脑(Linux)处理AWS实例(机器学习任务)。我想运行我的代码,然后退出会话,停止计算机。我如何在不停止程序执行的情况下完成这项工作,这可能需要1天的时间 目前,我使用以下命令: ssh-i$HOME/.ssh/file.pem ubuntu@[IP-AWS]连接到AWS实例 docker run--gpus all-u$(id-u):$(id-g)-it--rm--name tempo-v/data:/tf[MY_IMAGE]/bin/bash打开docker镜像 pyth

我正在使用笔记本电脑(Linux)处理AWS实例(机器学习任务)。我想运行我的代码,然后退出会话,停止计算机。我如何在不停止程序执行的情况下完成这项工作,这可能需要1天的时间

目前,我使用以下命令:

ssh-i$HOME/.ssh/file.pem ubuntu@[IP-AWS]
连接到AWS实例

docker run--gpus all-u$(id-u):$(id-g)-it--rm--name tempo-v/data:/tf[MY_IMAGE]/bin/bash
打开docker镜像

python train.py[MY_INSTRUCTIONS]2>&1 | tee out_file
运行脚本运行脚本

我的脚本不使用计算机中的文件,
/data
磁盘已连接到实例。没有必要开着电脑。 但若我关闭终端,程序就会停止

如何执行相同的任务:启动脚本,然后断开连接?我怎么知道程序什么时候停止

我找到了
nohup
命令,但我不知道如何在我的案例中使用它(我是初学者)


提前感谢您的帮助。

您可以在后台使用-d运行docker容器,如本文所述(使用
docker run-d
):


您还应该删除-it标志。这些标记将流程标记为“交互式”,因此它将询问/等待用户输入。

非常感谢!我看错了方向(如何使用
ssh
而不是正确使用
docker
)。Np,如果有帮助,请将答案标记为正确!