Issue
I'm working on AWS instance (machine learning task) from my laptop (Linux). I would like run my code and go out from session, stop computer. How can I do it whitout stopping program execution that can take 1 day?
For the moment I use these commands:
ssh -i $HOME/.ssh/file.pem ubuntu@[IP-AWS]
to connect to AWS instance.
docker run --gpus all -u $(id -u):$(id -g) -it --rm --name tempo -v /data:/tf [MY_IMAGE] /bin/bash
to open docker image
python train.py [MY_INSTRUCTIONS] 2>&1 | tee out_file
to run script to run my script
My Script does not use files in my computer, /data
disk is attached to instance. There is no need to keep computer on.
But if I close terminal, program is stopped.
How can I do the same task: launch script and then disconnect? How can I know when the program stops?
I found nohup
command, but I did not understand how use it in my case (I'm a beginner).
Thanks in advance for any help.
Solution
You can do so by running the docker container in the background with -d as discussed here (using docker run -d
):
https://stackoverflow.com/a/31570507/4358503
Also you should remove the -it flags. Those mark the process as 'interactive' so it will ask/wait for user input.
Answered By - Datise Answer Checked By - Gilberto Lyons (WPSolving Admin)