Sometimes you want to jump right into a running job to see what's going on. Or maybe you want to move some files around on your persistent file store. You could run each command as a Job itself, or even easier, just SSH directly into the job
Setup a Job with SSH
Not every container is built to support SSH directly. We have made a simple container available to show what is required to open up SSH. You can run this container directly using the following command from your command line:
paperspace jobs create --machineType P100 --container Test-Container --ports 8888:22 --command 'bash run.sh' --workspace "https://github.com/Paperspace/gradient-ssh-test.git"
SSH into the Job
Once this job is running it will appear to stop at
processing triggers for systemd. This is expected behavior as it waits for the SSH connection.
You can now SSH to your job by getting the public IP address from your console (https://www.paperspace.com/console/jobs) and then typing:
ssh firstname.lastname@example.org -p 8888
Note: We are forwarding port
8888 to the container's SSH port
22 which you can see in the
--ports 8888:22 portion of the job run. This is because the host node cannot expose port
22 directly as it is reserved for internal communication. (Coming soon: There are some ports that cannot be added. They'll be listed here soon!)
You will be prompted for a password. The script that we called created the password mys3cr3t@PW which you can confirm here (https://github.com/Paperspace/gradient-ssh-test/blob/master/run.sh#L4). We highly recommend changing this password before running it yourself. You can do this by modifying the run.sh script
Check out the accompanying GitHub repo here: https://github.com/Paperspace/gradient-ssh-test