From 8a36f8764c2a188378d2f7d5603b0700f74ab6dd Mon Sep 17 00:00:00 2001 From: Adeel Ahmad Date: Sat, 10 Oct 2026 16:56:39 +0000 Subject: [PATCH] fix(install): pull the microsandbox base image from mirrors that need no sign-in On a Mac, msb's pull of python:3.12-slim-bookworm from Docker Hub failed with "Not authorized". install.sh now pulls it from mirror.gcr.io, then public.ecr.aws, then Docker Hub, and starts the sandbox from whichever answered. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01VvAGWoQxiwkGkk374pvkSh --- docs/microsandbox.md | 3 ++- install.sh | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/microsandbox.md b/docs/microsandbox.md index c763fcbb4..cf99feeb8 100644 --- a/docs/microsandbox.md +++ b/docs/microsandbox.md @@ -28,7 +28,8 @@ It needs hardware virtualization: ## How it runs microsandbox runs images but can't build them, and its sandboxes can't reach each other by name, so Lens runs as one -sandbox named `lens`, started from the stock `python:3.12-slim-bookworm` image. Inside it, +sandbox named `lens`, started from the stock `python:3.12-slim-bookworm` image (from Google's or Amazon's mirror of +Docker Hub, which need no sign-in; Docker Hub itself last). Inside it, [`microsandbox/run.sh`](https://github.com/adeelahmad/lense/blob/main/microsandbox/run.sh) does what the Docker images do: diff --git a/install.sh b/install.sh index 9ef83cc9e..794d35e45 100755 --- a/install.sh +++ b/install.sh @@ -281,6 +281,18 @@ if [ "$BACKEND" = microsandbox ]; then [ "$mem" -gt 8192 ] && mem=8192 cpus="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)" sensors="${LENS_SENSOR_BIND:-$bind}" + # The stock Python image, from mirrors that need no sign-in first: Docker Hub can refuse it ("Not authorized") when + # this machine has Docker Hub credentials that microsandbox can't use, and limits anonymous pulls. + say "Getting the base image..." + image="" + for ref in mirror.gcr.io/library/python:3.12-slim-bookworm public.ecr.aws/docker/library/python:3.12-slim-bookworm \ + docker.io/library/python:3.12-slim-bookworm; do + if out="$(msb pull -q "$ref" 2>&1)"; then + image="$ref" + break + fi + done + [ -n "$image" ] || fail "Couldn't download the base image (python:3.12-slim-bookworm): $out" # The internet, this network (mail servers, model servers) and this machine (Ollama, LM Studio); only the web app # and the sensor ports are published, as with Docker. set -- run -d -q --name lens --replace -c "$cpus" -m "${mem}M" --root-disk 16G --net public,private,host \ @@ -288,7 +300,7 @@ if [ "$BACKEND" = microsandbox ]; then -p "$sensors:${LENS_MQTT_PORT:-1883}:1883" \ -p "$sensors:${LENS_SYSLOG_PORT:-5514}:5514/udp" -p "$sensors:${LENS_SYSLOG_PORT:-5514}:5514/tcp" \ -v "$PWD:/lens:ro" --mount-named lens-data:/data \ - --entrypoint /bin/sh python:3.12-slim-bookworm -- /lens/microsandbox/run.sh + --entrypoint /bin/sh "$image" -- /lens/microsandbox/run.sh say "Starting Lens in a microsandbox (the first start installs and builds it, which takes a while)..." # The command that starts it, kept for a restart of the machine: a sandbox started again (msb start) boots without # running Lens, so it is always replaced; its packages come from the cache in the volume, its build stays there.