For the complete documentation index, see llms.txt. A markdown version of this page is at /reference/resources/localbinding/index.md.

LocalBinding

A forward of a workstation's ports and Unix sockets to your computer, and of your computer's services into a workstation.

A LocalBinding describes what this computer forwards from a workstation: TCP ports and Unix sockets, statically or by auto-discovery. It also carries a service on this computer into a workstation (reversePorts). It is the single interface for forwarding on a computer, and it is never routed or synced: each computer owns and writes its own.

apiVersion: core.ringleader.dev/v1
kind: LocalBinding

Port and socket forwarding explains how Ringleader seeds a LocalBinding from a workstation’s configuration, and shows recipes. Services on your computer covers reversePorts.

Spec fields

FieldTypeDescription
enabledboolMaster on/off switch (default true). The CLI enable/disable flips this. A seed for a workstation shared with you is created with false.
onPortConflictstringWhat a TCP forward does when its port on this computer is taken: reassign moves it to a free port, and drop leaves it unforwarded. When it is absent, a forward that uses the workstation’s port number, or the number portOffset gives it, moves, and a forward with a nonzero localPort stays. A forward with localPort: 0 always gets a port the daemon chooses. An entry’s own onPortConflict overrides this one.
workstationSelector.matchNamestringTarget a single workstation by exact name.
workstationSelector.matchLabelsmapSelect potentially many workstations by labels.
autoForward.forwardAllboolForward every discovered listening port.
autoForward.portOffsetintBulk-shift the host port of every 1:1 auto-forward (workstation 8080 → host 18080 when 10000); 0/absent ⇒ 1:1. A per-port localPort override is absolute (not shifted).
autoForward.ports[][]objectPer-port overrides: {port, enabled, localPort, onPortConflict}. With localPort: 0, the daemon chooses the port and saves it.
ports[][]objectStatic TCP forwards: {remotePort, localPort, onPortConflict}. Without localPort, the port on this computer is remotePort. With localPort: 0, the daemon chooses the port and saves it.
sockets[][]objectStatic Unix-socket forwards: {remotePath, localPath, docker}. docker: true marks the entry as the workstation’s Docker socket. The daemon sets it on the entry it creates from a workstation’s defaultLocalBinding.dockerSocket, and Ringleader finds the Docker forward by this marker first. Without the marker, an entry whose remotePath ends in docker.sock counts as the Docker socket.
reversePorts[][]objectServices on this computer carried into each selected workstation: {localPort, remotePort}. The workstation listens on its own 127.0.0.1:remotePort (default: localPort), and each connection reaches 127.0.0.1:localPort on this computer.
urlForward.enabledboolLet this computer read the links a workstation tries to open, as Browser sign-in explains.
urlForward.openboolDeprecated, and has no effect. The rules on your computer decide whether a link opens, as rl urlopenrules sets.

Provide exactly one of workstationSelector.matchName or matchLabels.

portOffset shifts only the 1:1 auto-forwards (a workstation port with no explicit localPort override); static ports[] and per-port localPort values are left absolute. If a shifted host port would fall outside the valid 1–65535 range, the offset is skipped for that one port (it forwards 1:1) rather than wrapping around, so a large offset never lands a high workstation port on 0 or a privileged low port.

Status fields

The daemon writes these per computer.

FieldTypeDescription
messagestringThe one human headline, e.g. 3 forwards active, 2 forwards active, 1 dropped, port forwarding is disabled for this binding, or no connected workstation matches matchName=web.
bindings[][]objectEndpoints actually forwarded right now: {kind, workstation, remotePort/localPort or remotePath/localPath, source, active}. kind is tcp, unix or reverse; for reverse, localPort is on this computer and remotePort in the workstation. source is static, auto, or seeded. A TCP forward that moved off the nonzero port it asked for carries that port as wantedLocalPort, and one that asked for localPort: 0 carries daemonSelected: true.
reservedPorts[][]objectThe ports saved for this binding’s forwards, as {workstation, localPort}. See Saved ports.
dropped[][]objectWanted forwards not forwarded, each with a human reason (e.g. host-port conflict, or a port the workstation would not listen on). wantedLocalPort is the port the forward asked for. taken: true means something on this computer holds the port. When another LocalBinding holds it, heldBy names that binding and heldByWorkstation its workstation. attemptedLocalPort is the port the daemon last found taken, when that differs from wantedLocalPort.
conditions[][]objectA Ready condition. Its reason is one of Disabled, DisabledSeed, Degraded, NotConnected, NoForwards, SharedWorkstation or Pending. DisabledSeed means the daemon created the binding disabled because the workstation is shared with you; its message gives the rl binding enable command that starts the forwarding. SharedWorkstation means the binding matched only workstations shared with you, and their owner has not set defaultLocalBinding.scope: accessors.

status.message is derived from the same computation as the Ready condition, so the headline and the condition can never disagree. Read the condition’s own message for the per-aspect detail.

Conflict handling

When two TCP forwards want the same port on this computer, the daemon gives it out in this order:

  1. A port saved for a forward stays with that forward.
  2. A port a forward already holds stays with it. The exception is two forwards that can’t move and ask for the same port: step 3 decides between them.
  3. Forwards that can’t move come next. If one sets a nonzero localPort, the daemon reserves that port for it, even while its workstation is stopped.
  4. Forwards that can move and set localPort come next.
  5. Forwards that use the workstation’s port number, or the number portOffset gives them, come last.

Within a step, forwards go by workstation namespace and name, then by binding namespace and name. A forward that can’t move and loses is reported in status.dropped with the reason.

A new forward that can move doesn’t take a reserved port. For example, a LocalBinding sets localPort: 8080 and no onPortConflict for the workstation api-box, which is stopped. If web-box then starts and listens on 8080, its forward goes to 18080, and the daemon keeps 8080 for api-box.

A ports[] or autoForward.ports[] entry reserves its port when all of these are true:

  • The entry sets a nonzero localPort.
  • Its forward can’t move. If onPortConflict is reassign on the entry, or on the LocalBinding when the entry sets none, the forward can move and the entry reserves nothing.
  • The entry and its LocalBinding are enabled.

The reservation ends when one of these stops being true, or when you remove the entry or its LocalBinding. It doesn’t move a forward that already holds the port or has it saved, as steps 1 and 2 say.

When a forward that can move loses, or asks for a reserved port, it takes the first free port at or above its requested port plus 10000. With localPort: 0, the search starts from the workstation port plus 10000. If that number is above 65535, the search starts at 20000 instead. The search skips ports that other forwards hold or ask for, saved ports, and every nonzero localPort set in an enabled LocalBinding.

When another program on this computer holds the port, a forward that can move continues the same search to the next free port. A forward that can’t move is reported in status.dropped, and the daemon tries its port again about 30 seconds later.

A ports[] entry that can’t move forwards from the first workstation the binding selects, by namespace and name. An entry that can move forwards from every workstation it selects, each on its own port. Inspect the live picture with rl binding show.

Saved ports

The daemon saves the port of each forward that can move and that names its port: a ports[] entry, an autoForward.ports[] entry, or a port the workstation’s configuration declares. It saves the port even when the forward got the one it asked for. The record is kept on this computer and lasts through reconnects, workstation stops, and restarts of the workstation or the daemon. status.reservedPorts lists the saved ports. A port that only forwardAll found isn’t saved. Its forward keeps the same port on this computer only while the workstation stays connected and keeps listening on that port.

If another program takes a saved port, the forward is reported in status.dropped. The daemon tries the port again after about 30 seconds. If the program still holds it, the daemon chooses a new port and saves that one.

The daemon forgets a saved port when the binding or the port’s entry is removed or disabled, when the binding no longer selects the workstation, when the port the entry asks for changes, or when the workstation is deleted. If the daemon can’t tell whether the workstation was deleted, it keeps the port.