Skip to content

docker-sbx gateway: sbx ssh proxy needs the sbx cache and state paths #61

Description

@czpython

The gateway's loopback tunnel (#57) runs sbx ssh proxy inside the gateway container. The container runs with HOME=/, and then the tunnel fails:

error: the sandboxd SSH endpoint is disabled; restart sandboxd after enabling it

The daemon has SSH on: sbx ssh proxy on the host works, and the daemon log says ssh server ready. The container's sbx client fails for two reasons:

  1. sbx reads its feature flags from $XDG_CACHE_HOME/sandboxes (unleash-toggles-production.json). With HOME=/ it finds none, so it treats feature.ssh as off and never calls the daemon.
  2. sbx ssh proxy dials the daemon socket under $XDG_STATE_HOME/sandboxes/sandboxes/sandboxd/sandboxd.sock. It ignores DOCKER_SANDBOXES_API.

This happens with sbx 0.39.0 and 0.45.1 on Linux. On macOS, sbx keeps its cache in ~/Library/Caches/com.docker.sandboxes and ignores XDG_CACHE_HOME, so macOS does not show the failure.

It works when the gateway gets:

environment:
  XDG_CACHE_HOME: ${DRUKS_SBX_HOME}/.cache
  XDG_STATE_HOME: ${DRUKS_SBX_HOME}/.local/state
volumes:
  - ${DRUKS_SBX_HOME}/.cache/sandboxes:${DRUKS_SBX_HOME}/.cache/sandboxes
  - ${DRUKS_SBX_HOME}/.local/state/sandboxes/sandboxes/sandboxd/sandboxd.sock:${DRUKS_SBX_HOME}/.local/state/sandboxes/sandboxes/sandboxd/sandboxd.sock

Also: the socket is mounted as a file

The compose file mounts sandboxd.sock as one file. A daemon restart, such as an sbx upgrade or a settings change that needs a restart, makes a new socket. The containers keep the old one and cannot reach the daemon until they are recreated.

Expected

In drukbox (#62):

  • diagnose reports when sbx ssh proxy cannot reach the SSH endpoint. It requires the daemon's SSH banner from a probe that selects no sandbox.
  • The container recipe in docs/deploy.md mounts the directory of the daemon socket, not the socket file. It sets XDG_CACHE_HOME and XDG_STATE_HOME, and it mounts the sbx cache. The gateway container needs the same mounts and variables.

In the deployment's compose file:

  • The drukbox services get the sbx cache and state paths, as the recipe shows.
  • The compose file mounts the directory of the daemon socket, not the socket file, so a daemon restart does not cut the containers off.
  • On the deploy host, sbx ssh proxy from the gateway container prints an SSH banner, also after a daemon restart without a container restart.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions