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"}
Prepare the inside of the box
Section titled “Prepare the inside of the 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.
Name the box and its command
Section titled “Name the box and its 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
remote: boxes: devbox: command: [docker, exec, -i, devbox, devlanes, tunnel, --stdio]remoteSettings for devlanes remote connect: boxes reached by a command, and how this machine serves clients when it is a box.
remote.boxesBoxes that devlanes remote connect <name> reaches by running a command instead of SSH, keyed by that name. Use it for a container, a WSL distribution or a codespace. Names not listed here are SSH destinations. Changes apply at the next remote connect.
remote.boxes.<name>A box that devlanes remote connect <name> reaches by running a command. The command must run devlanes tunnel --stdio in the box.
remote.boxes.<name>.commandThe program and its arguments as a list, one item per argument. No shell runs it. It must run devlanes tunnel --stdio in the box with its input and output passed through and no terminal, so use docker exec -i, not -it. It runs again for every reconnect and cannot ask for input, so sign in to its tool first.
Keep -i and leave out Docker’s terminal flag.
Kubernetes
remote: boxes: devbox: command: [kubectl, exec, -i, devbox-0, -c, app, --, devlanes, tunnel, --stdio]remoteSettings for devlanes remote connect: boxes reached by a command, and how this machine serves clients when it is a box.
remote.boxesBoxes that devlanes remote connect <name> reaches by running a command instead of SSH, keyed by that name. Use it for a container, a WSL distribution or a codespace. Names not listed here are SSH destinations. Changes apply at the next remote connect.
remote.boxes.<name>A box that devlanes remote connect <name> reaches by running a command. The command must run devlanes tunnel --stdio in the box.
remote.boxes.<name>.commandThe program and its arguments as a list, one item per argument. No shell runs it. It must run devlanes tunnel --stdio in the box with its input and output passed through and no terminal, so use docker exec -i, not -it. It runs again for every reconnect and cannot ask for input, so sign in to its tool first.
WSL
remote: boxes: devbox: command: [wsl.exe, -d, Ubuntu, --exec, /home/you/.local/bin/devlanes, tunnel, --stdio]remoteSettings for devlanes remote connect: boxes reached by a command, and how this machine serves clients when it is a box.
remote.boxesBoxes that devlanes remote connect <name> reaches by running a command instead of SSH, keyed by that name. Use it for a container, a WSL distribution or a codespace. Names not listed here are SSH destinations. Changes apply at the next remote connect.
remote.boxes.<name>A box that devlanes remote connect <name> reaches by running a command. The command must run devlanes tunnel --stdio in the box.
remote.boxes.<name>.commandThe program and its arguments as a list, one item per argument. No shell runs it. It must run devlanes tunnel --stdio in the box with its input and output passed through and no terminal, so use docker exec -i, not -it. It runs again for every reconnect and cannot ask for input, so sign in to its tool first.
--exec skips the distribution’s shell, so the path to devlanes is absolute.
Codespace
remote: boxes: devbox: command: [gh, codespace, ssh, -c, myapp-x9q7, --, devlanes, tunnel, --stdio]remoteSettings for devlanes remote connect: boxes reached by a command, and how this machine serves clients when it is a box.
remote.boxesBoxes that devlanes remote connect <name> reaches by running a command instead of SSH, keyed by that name. Use it for a container, a WSL distribution or a codespace. Names not listed here are SSH destinations. Changes apply at the next remote connect.
remote.boxes.<name>A box that devlanes remote connect <name> reaches by running a command. The command must run devlanes tunnel --stdio in the box.
remote.boxes.<name>.commandThe program and its arguments as a list, one item per argument. No shell runs it. It must run devlanes tunnel --stdio in the box with its input and output passed through and no terminal, so use docker exec -i, not -it. It runs again for every reconnect and cannot ask for input, so sign in to its tool first.
Sign in to the tool first
Section titled “Sign in to the tool first”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.
$ gh auth loginPair and connect
Section titled “Pair and connect”Pairing works as Connect to a box describes, with the box’s half run through the same tool.
$ docker exec devbox devlanes daemon pair$ devlanes remote connect devbox --code K7QM-3XWD --backgroundIf 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.
If WSL holds the box’s ports on Windows
Section titled “If WSL holds the box’s ports on Windows”WSL forwards the distribution’s ports to Windows, where they block mirroring. Turn that off and restart WSL.
[wsl2]localhostForwarding=falsePS> wsl.exe --shutdown