Skip to content

devlanes is in beta and not ready for production use.Report an issue

Connect to a box without SSH

A container, a pod, a WSL distribution or a codespace can be a box without an SSH server, through the command that runs a program inside it.

::example{slug="remote-docker-box"}

Install devlanes inside the box, give it its own ports and start the project there, as Prepare a box shows. Linger and the service do not apply to a container. Put devlanes on the path the command gets, or name it by its full path in the command.

Give the box a name under remote.boxes.<name>.command, with a command that runs devlanes tunnel --stdio inside it, one list item per argument. No shell runs it.

Docker

~/.devlanes/config.yaml
remote:
boxes:
devbox:
command: [docker, exec, -i, devbox, devlanes, tunnel, --stdio]

Keep -i and leave out Docker’s terminal flag.

Kubernetes

~/.devlanes/config.yaml
remote:
boxes:
devbox:
command: [kubectl, exec, -i, devbox-0, -c, app, --, devlanes, tunnel, --stdio]

WSL

%USERPROFILE%\.devlanes\config.yaml
remote:
boxes:
devbox:
command: [wsl.exe, -d, Ubuntu, --exec, /home/you/.local/bin/devlanes, tunnel, --stdio]

--exec skips the distribution’s shell, so the path to devlanes is absolute.

Codespace

~/.devlanes/config.yaml
remote:
boxes:
devbox:
command: [gh, codespace, ssh, -c, myapp-x9q7, --, devlanes, tunnel, --stdio]

The command runs under your daemon with no terminal, so nothing can answer a prompt. Sign in to the tool beforehand, as for the GitHub CLI.

on your machine
$ gh auth login

Pairing works as Connect to a box describes, with the box’s half run through the same tool.

on your machine
$ docker exec devbox devlanes daemon pair
$ devlanes remote connect devbox --code K7QM-3XWD --background

If a tool needs a variable from your shell

Section titled “If a tool needs a variable from your shell”

The daemon keeps only some of your shell’s variables, listed under Variables a new daemon keeps. Sign in to a tool in a way it saves to a file or the system’s credential store.

WSL forwards the distribution’s ports to Windows, where they block mirroring. Turn that off and restart WSL.

%USERPROFILE%.wslconfig
[wsl2]
localhostForwarding=false
on your machine
PS> wsl.exe --shutdown