dstack attach¶
This command attaches to a given run. It establishes the SSH tunnel, forwards ports, and shows real-time run logs.
Usage¶
$ dstack attach --help
Usage: dstack attach [-h] [--project NAME] [--ssh-identity SSH_PRIVATE_KEY]
[--logs] [--host HOST] [-p MAPPING] [--replica REPLICA]
[--job JOB] [--since SINCE]
run_name
Positional Arguments:
run_name
Options:
-h, --help Show this help message and exit
--project NAME The name of the project. Defaults to $DSTACK_PROJECT
--ssh-identity SSH_PRIVATE_KEY
The private SSH key path for SSH tunneling
--logs Print run logs as they follow
--host HOST Local address to bind. Defaults to localhost.
-p, --port MAPPING Port mapping overrides
--replica REPLICA The replica number. Defaults to any running replica.
--job JOB The job number inside the replica. Defaults to 0.
--since SINCE Show only logs newer than the specified date. Can be a
duration (e.g. 10s, 5m, 1d) or an RFC 3339 string
(e.g. 2023-09-24T15:30:00Z).
User SSH key¶
By default, dstack uses its own SSH key to attach to runs (~/.dstack/ssh/id_rsa).
It is possible to override this key via the --ssh-identity argument.