You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/software/container-engine.md
+31-22Lines changed: 31 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -538,38 +538,47 @@ At the moment of writing, 4 plugin variants are configured: `cuda11`, `cuda12`
538
538
[](){#ref-ce-ssh-hook}
539
539
### SSH Hook
540
540
541
-
The SSH hook runs a lightweight, statically-linked SSH server (a build of [Dropbear](https://matt.ucc.asn.au/dropbear/dropbear.html)) inside the container. It can be useful to add SSH connectivity to containers (for example, enabling remote debugging) without bundling an SSH server into the container image or creating ad-hoc image variants for such purposes.
542
-
543
-
The `com.hooks.ssh.authorize_ssh_key` annotation allows the authorization of a custom public SSH key for remote connections. The annotation value must be the absolute path to a text file containing the public key (just the public key without any extra signature/certificate). After the container starts, it is possible to get a remote shell inside the container by connecting with SSH to the listening port.
By default, the server started by the SSH hook listens to port 15263, but this setting can be controlled through the `com.hooks.ssh.port` annotation in the EDF.
547
+
1. Replace `<public-key>` with your SSH public key.
546
548
547
549
!!! note
548
-
To use the SSH hook, it is **required**to keep the container **writable**.
550
+
The `srun` command launching an SSH-connectable container **should set the `--pty` option**in order for the hook to initialize properly.
549
551
550
-
The following EDF file shows an example of enabling the SSH hook and authorizing a user-provided public key:
552
+
The SSH hook runs a lightweight, statically-linked SSH server (a build of [Dropbear](https://matt.ucc.asn.au/dropbear/dropbear.html)) inside the container.
553
+
While the container is running, it's possible to connect to it from a remote host using a private key matching the public one authorized in the EDF annotation.
554
+
It can be useful to add SSH connectivity to containers (for example, enabling remote debugging) without bundling an SSH server into the container image or creating ad-hoc image variants for such purposes.
551
555
552
-
```bash
553
-
> cat $HOME/.edf/ubuntu-ssh.toml
554
-
image = "ubuntu:latest"
555
-
writable = true
556
+
The `com.hooks.ssh.authorize_ssh_key` annotation allows the authorization of a custom public SSH key for remote connections.
557
+
The annotation value must be the absolute path to a text file containing the public key (just the public key without any extra signature/certificate).
558
+
After the container starts, it is possible to get a remote shell inside the container by connecting with SSH to the listening port.
556
559
557
-
[annotations.com.hooks.ssh]
558
-
enabled = "true"
559
-
authorize_ssh_key = "<public key file>"
560
-
```
560
+
By default, the server started by the SSH hook listens to port 15263, but this setting can be controlled through the `com.hooks.ssh.port` annotation in the EDF.
561
+
562
+
!!! note
563
+
The container must be **writable** (default) to use the SSH hook.
561
564
562
-
Using the previous EDF, a container can be started as follows. Notice that the `--pty` option for the `srun` command is currently required in order for the hook to initialize properly:
565
+
!!! example "Logging into a sleeping container via SSH"
566
+
* On the cluster
567
+
```bash
568
+
$ cat ubuntu-ssh.toml
569
+
image = "ubuntu:latest"
563
570
564
-
```bash
565
-
> srun --environment=ubuntu-ssh --pty <command>
566
-
```
571
+
[annotations]
572
+
com.hooks.ssh.enabled = "true"
573
+
com.hooks.ssh.authorize_ssh_key = "<public-key>"
567
574
568
-
While the container is running, it's possible to connect to it from a remote host using a private key matching the public one authorized in the EDF annotation. For example, in a host where such private key is the default identity file, the following command could be used:
In order to establish connections through Visual Studio Code [Remote - SSH](https://code.visualstudio.com/docs/remote/ssh) extension, the `scp` program must be available within the container.
0 commit comments