Skip to content

fix(vm-driver): find Docker Desktop's socket when looking up local images - #4183

Open
shiju-nv wants to merge 2 commits into
ai-openshell:mainfrom
shiju-nv:fix/vm-driver-docker-desktop-socket-4155
Open

shiju-nv wants to merge 2 commits into
ai-openshell:mainfrom
shiju-nv:fix/vm-driver-docker-desktop-socket-4155

Conversation

@shiju-nv

@shiju-nv shiju-nv commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The MicroVM driver can now find locally built images when Docker Desktop exposes only ~/.docker/run/docker.sock on macOS. Previously, creating a sandbox from a local tag could fall through to a registry pull and produce an authorization error.

Related Issue

Refs #4155. This fixes local image discovery. The issue also describes separate improvements to registry errors and openshell doctor check.

Changes

  • The Docker and VM drivers use the same Docker socket detector in openshell-container-runtime. It checks a Unix DOCKER_HOST, /var/run/docker.sock, $HOME/.docker/run/docker.sock, and $XDG_RUNTIME_DIR/docker.sock, in order. The Docker driver keeps its public detect_socket function.
  • The VM tries Bollard’s default Unix connection first. If that fails, it tries the discovered Docker socket, then Podman. A discovered Docker engine takes precedence even when only Podman has the requested tag.
  • Socket discovery runs on Tokio’s blocking pool so a slow probe leaves the async worker free to handle other requests.

Testing

  • Two VM tests use temporary Unix sockets to cover a missing default socket, a failed default ping, Docker discovery and precedence, Podman fallback, and unavailable engines.
  • The existing Docker driver startup test finds the socket from DOCKER_HOST when the configuration leaves socket_path unset.
  • Formatting passed for the three affected crates.
  • End-to-end tests run in hosted CI under the existing test:e2e label.

Checklist

  • Follows Conventional Commits.
  • The commit includes a DCO sign-off.
  • Updated the VM driver prerequisites and shared runtime README.

Comment thread crates/openshell-driver-vm/Cargo.toml Resolved
@shiju-nv
shiju-nv requested a review from drew October 13, 2026 07:41
@shiju-nv
shiju-nv force-pushed the fix/vm-driver-docker-desktop-socket-4155 branch from 8fc1396 to 3080769 Compare October 22, 2026 18:59
@shiju-nv shiju-nv added the test:e2e Requires end-to-end coverage label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Label test:e2e applied for 3080769. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@purp purp added the area:drivers Compute and secret drivers, host OS/architecture support, backend isolation, and lifecycle. label Nov 15, 2026
@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Nov 29, 2026
A VM sandbox built from a local tag could fall back to the registry when
Docker Desktop exposed only its per-user socket. Share Docker's existing
socket discovery with the VM driver through openshell-container-runtime.

Keep the default Unix connection first, then try discovered Docker and
Podman sockets in order. Run the blocking probes off the async worker
that resolves the image.

Refs ai-openshell#4155

Signed-off-by: Shiju <shiju@nvidia.com>
@shiju-nv
shiju-nv force-pushed the fix/vm-driver-docker-desktop-socket-4155 branch from 3080769 to 05d8108 Compare December 1, 2026 08:05
@shiju-nv shiju-nv removed the state:stale Inactive item at risk of automatic closure. label Dec 1, 2026

@elezar elezar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the shared docker_socket module in openshell-container-runtime also resolves the earlier dependency concern: the VM driver no longer depends on the Docker driver.

One change I'd like before merge:

  • connect_engine_socket (driver.rs:5876) uses spawn_blocking(...).await.ok()??, so a panicked or cancelled discovery task becomes None. The user would then see a registry-pull attempt, or "no container engine available" for locally built tags, with no hint of the cause. Please log the join error before returning None.

Nits, not blocking:

  • Step 1 (connect_with_local_defaults) and step 2 (detect_socket) can probe the same dead path, for example when DOCKER_HOST is unix:///var/run/docker.sock. The cost is one extra local failure before the Podman fallback. Keeping the Bollard default is right, since detect_socket only handles unix:// hosts.
  • A short comment on why the tests use tempdir_in("/tmp") (Unix socket path length) would help.
  • Discovery covers only the well-known paths, so Colima, Rancher Desktop, and custom Docker contexts still need DOCKER_HOST. That's fine for this fix, but worth a follow-up issue.

Log the engine and Tokio join error when a socket discovery task fails.
Keep trying other image sources and cover a panicking Docker detector
with a working Podman socket. Document how to select a custom Unix
socket in the gateway environment.

Signed-off-by: Shiju <shiju@nvidia.com>

This branch has not been deployed

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

Labels

area:drivers Compute and secret drivers, host OS/architecture support, backend isolation, and lifecycle. test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants