Repository navigation
fix(standard): use podman when docker is installed but does not answer - #243
Merged
Merged
Conversation
With both docker and podman on the PATH, the container backend chose docker by presence alone, so a docker that refuses this user or has no daemon blocked the standard's container runs even where podman works. The engine is now docker unless `docker ps` fails and `podman ps` succeeds, on this machine (container.engine) and in a host's probe (hosts.test) alike, so the probe and the standard's run there agree. Only a machine with both is asked; with one engine the choice costs no call. Where neither answers, docker is kept and its reason is said as before.
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.
Closes #242
What
One rule in both places: docker, unless
docker psfails andpodman pssucceeds. When neither answers, the choice stays as today, docker if it is installed, else podman, so the reason given is unchanged.standard/container.py)._answers(program)runs<program> pswith a 10 s limit.engine()asks it only when both programs are on the PATH anddockeris not podman under that name. A machine with only one of them makes no call.DOCKERis still chosen once, when the module is imported.unusable()now says "Nullius uses it when docker does not answer and podman does".hosts.py). The probe already ran<engine> psfor each engine. Itsenginenow applies the same rule todocker_okandpodman_ok. A run on the host goes through the standard's own code there, which calls the sameengine(), so the probe and the run pick the same engine.sandbox.py,settings/sandbox.js,settings/settings.html).docker_state()addsalsowhen both engines are installed: the other one, with its version or the last line of why it does not answer.dockerscript counts as the same program, not as a second engine.The builder,
prerequisitesandexecution.pyread the chosen engine and its_okand need no change. Harbor recipes still needdocker, which is Harbor's own requirement.Touches
backend (
nullius/standard/container.py,nullius/hosts.py,nullius/sandbox.py) · static and templates (settings/sandbox.js,settings/settings.html) · tests · docs (docs/standard.md, the Backends row)Before and after
Before, on main, Settings → Sandbox shows "✕ docker is installed but not usable by this user: … podman is on this machine: Nullius uses it when docker is not on the PATH", and nothing runs on the container backend.
After, in a preview container with both programs installed:
Verified
With stub programs on a PATH that holds nothing else, the same checks on main and on this branch:
container.engine()dockerpodmansandbox.docker_state()ok: False, the docker errorok: True,podman …,also: docker does not answerprerequisites.check_here(["engine"], standard=True)missingokhosts.testengine: dockerengine: podmanA preview with real programs: an app container with docker.io and podman 5.4.2, and two ssh hosts with both, on Fedora's podman image.
docker pssays "permission denied while trying to connect to the docker API", picks podman.In a throwaway rootless
python:3.12container with Node.js and uv:python3 app/tests/parallel.py: 3078 tests in 156 modules, OK.pip install -r app/requirements.txt, thenpython3 app/tests/parallel.py app/ui_tests: 674 tests in 55 modules, OK.test_standard_container.py: with both on the PATH, the one that answers is the engine (podman, docker, and docker when neither answers); the host probe andengine()pick the same engine; the Sandbox names the other engine when both are installed, and not podman'sdockerscript; the updated hint.test_hosts.py: the probe's engine for each combination ofdocker_okandpodman_ok.test_sandbox.py: the engine named with its version is asked with no other engine on the PATH, so a docker installed on the machine running the suite does not change it.Not checked: a real run through podman in the preview, the docker test tier, and a host reached over a network rather than a local container.
Risk
docker ps, andpodman pswhen docker fails. Each takes up to 10 s if the engine hangs, for example aDOCKER_HOSTthat does not answer.