Support selecting the container engine (docker or Apple Container)#2643
Open
fnando wants to merge 2 commits into
Open
Support selecting the container engine (docker or Apple Container)#2643fnando wants to merge 2 commits into
fnando wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for selecting which container runtime the CLI shells out to for stellar container start|stop|logs, defaulting to docker while enabling Apple’s container CLI via --engine apple-container or STELLAR_CONTAINER_ENGINE. The change centralizes engine-specific command building and stderr classification, and wires engine awareness into diagnostics and integration tests.
Changes:
- Introduce an
Engineenum and engine-aware command builders/classifiers for pull/run/stop/logs. - Add
--engine <docker|apple-container>andSTELLAR_CONTAINER_ENGINE, including host-ignored warnings for non-docker engines. - Extend
stellar doctor, env var visibility, and integration tests to cover engine selection/argv propagation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| FULL_HELP_DOCS.md | Documents --engine for container commands (also includes an unrelated stellar xdr docs change). |
| cmd/soroban-cli/src/env_vars.rs | Registers CONTAINER_ENGINE so STELLAR_CONTAINER_ENGINE is surfaced in env tooling. |
| cmd/soroban-cli/src/commands/doctor.rs | Adds a doctor check to report whether the selected/default container engine binary is available. |
| cmd/soroban-cli/src/commands/container/stop.rs | Switches to engine-aware stop command + engine-aware stderr mapping and host-ignored warnings. |
| cmd/soroban-cli/src/commands/container/start.rs | Switches to engine-aware pull/run commands + engine-aware stderr mapping and host-ignored warnings. |
| cmd/soroban-cli/src/commands/container/shared.rs | Implements Engine, engine resolution, engine-aware command builders, warnings, and unit tests. |
| cmd/soroban-cli/src/commands/container/mod.rs | Exposes shared module within the crate for doctor integration. |
| cmd/soroban-cli/src/commands/container/logs.rs | Uses engine-aware logs command and emits host-ignored warnings. |
| cmd/crates/soroban-test/tests/it/main.rs | Registers new container integration test module on Unix. |
| cmd/crates/soroban-test/tests/it/container.rs | Adds integration tests using fake engines on PATH to validate argv propagation and behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
--engine <docker|apple-container>flag (andSTELLAR_CONTAINER_ENGINEenv var) tostellar container start|stop|logs, letting users pick which container runtime the CLI shells out to.dockerremains the default, so existing behavior is unchanged. Selectingapple-containerruns Apple'scontainerCLI (macOS 26+, Apple silicon) instead.Because Apple's runtime has no host concept,
--docker-host/DOCKER_HOSTis now ignored for non-docker engines with an advisory warning rather than being silently passed through.Implementation notes:
container/shared.rs: anEngineenum drives per-operation command builders (pull/run/stop/logs), so the only divergences live in one place — Apple usescontainer image pulland omits docker's--tail all.containerinstalled and on your PATH?").already exists/not found) were confirmed against the real CLI.startcarry--engineover;STELLAR_CONTAINER_ENGINEis registered instellar env; andstellar doctorreports whether the effective engine is installed.Apple Container
Apple Container using
STELLAR_CONTAINER_ENGINEDocker
stellar doctorWhy
PR #2629 replaced the
bollardDocker API client with directdockerCLI invocations. Now that we shell out to an external binary, supporting other docker-compatible runtimes is straightforward. Apple'scontaineris the immediate target, giving macOS users a native-VM alternative without Docker Desktop.Tested end-to-end against a real Apple
containerinstall: full start → logs → stop lifecycle, the host-ignored warning, engine-aware not-found error, and env-var selection all verified. Added a fake-engine-on-PATHintegration suite (tests/it/container.rs, 9 tests) covering argv propagation, stderr mapping, engine selection, and the binary-missing error, plus unit tests for the builders and classifiers.Known limitations
Apple's
containerrequires macOS 26 on Apple silicon and, unlike docker, does not support remote hosts, so--docker-hostis inert (with a warning) when that engine is selected.