DocsConnect with SSH
v1.16+

Connect with SSH

SSH access lets you use regular local developer tools against a service run with plugins.ssh enabled. Use it for terminal access, IDE remote development, SFTP, SCP, port forwarding, and rsync when the container image includes it.

This page continues from the Sandbox Quick Start and uses its quick-start project and RUN_UUID variable. The component created there already enables SSH.

Programmatic Access

The public Python client does not wrap SSH setup, local SSH clients, or port forwarding. Applications and agents should use the sandbox process and filesystem APIs when they do not need native SSH behavior:

result = sandbox.process.exec(command=["pwd"])
print(result.stdout, end="")

listing = sandbox.fs.ls("/workspace")
for entry in listing.entries or []:
    print(entry.type, entry.name)

Use the SSH CLI below for native terminals, IDE connections, SSH configuration, and tunnels.

Enable SSH

Enable the SSH plugin on a service run:

...
plugins:
  ssh: true

run:
  kind: service
  ...

Prepare SSH Access

Run setup once for the target run:

polyaxon ssh setup -p quick-start -uid $RUN_UUID

Polyaxon manages the default sandbox key and known hosts file unless you provide explicit files.

Connect

polyaxon ssh connect -p quick-start -uid $RUN_UUID

You can pass standard SSH options after --:

polyaxon ssh connect -p quick-start -uid $RUN_UUID -- -L 8888:127.0.0.1:8888 -N

Use Your SSH Client

Print a config block and add it to your SSH config:

polyaxon ssh config -p quick-start -uid $RUN_UUID >> ~/.ssh/config

Then connect with your local client:

ssh polyaxon-$RUN_UUID

The generated host can also be used by IDEs and file-transfer tools that support SSH config entries.

Reference

See the Python sandbox client, process, and filesystem references for programmatic access. See the SSH CLI reference for native SSH options.