Repository navigation
Description
Problem
Lines cited at dcafadf. At 132ecc5, ai/mcp/server.py:1317 is at :1340; the other cited lines have not moved. Paths are under src/devops_cli/ unless they start with tests/ or docs/. Paths marked docker-py are in the locked docker 7.2.0 (pyproject.toml:24). Paths marked Podman are at tag v6.1.3 of containers/podman, and compat/ there is short for pkg/api/handlers/compat/. Paths marked podman-py are in the podman 5.8.0 sdist on PyPI. The go-containerregistry path is at tag v0.22.1.
devops-cli reaches a container engine only through docker-py. DockerEngineService.client() builds its client with docker.from_env() (docker/engine.py:248-264), and the dashboard builds its own the same way (ui/data_providers.py:217-221). Everything else goes through get_engine(): commands/docker.py, docker/sandbox.py (and devops test through it, commands/test_cmd.py:374), sandbox/engine.py and sandbox/metrics.py:242-245. None of it knows Podman:
- With
DOCKER_HOSTunset and no Docker CLI context, the client dials/var/run/docker.sock. On a host that runs only rootless Podman, such as the maintainer's workstation, every container command and sandbox fails until the user exportsDOCKER_HOSTby hand. - Podman's endpoint variables are ignored:
CONTAINER_HOSTandCONTAINER_CONNECTION(Podmandocs/source/markdown/podman.1.md:215-236and:272-278,cmd/podman/root.go:220-262). No code looks for Podman's sockets either:$XDG_RUNTIME_DIR/podman/podman.sockfor rootless and/run/podman/podman.sockfor rootful (Podmandocs/source/markdown/podman-system-service.1.md:60-61). - The knowledge base says the SDK "connects seamlessly to Podman's Docker-compatible socket" (
ai/knowledge_base/devops_cli/libraries/docker.md:30), but nothing finds that socket. DEFAULT_CONTAINER_ENGINE = "docker"(config/defaults.py:713) andBIN_DOCKER(config/commands.py:26, re-exported atconfig/__init__.py:13and:489) are never read.
Podman's Docker-compatible API serves almost every call devops-cli makes (read from the Podman handlers):
- It serves:
- ping;
- container get, list, create, start, stop, remove, exec, logs, wait and stats;
- networks, with Docker-shaped attrs including
Internal; - image list, build, push and export;
df,infoandversion.
- The sandbox create kwargs are all mapped: network name,
Tmpfs,SecurityOpt(no-new-privileges:true) andNanoCPUs(Podmanpkg/api/handlers/compat/containers_create.go:395-410,:471,:497-502). They come fromsandbox/engine.py:221-255,docker/sandbox.py:265-276andSandboxPolicy.to_docker_security_kwargs(sandbox/models.py:380-389). - A build reports the image ID in the form docker-py's
images.buildreads: aSuccessfully built <id>stream line (Podmancompat/images_build.go:909, docker-pymodels/images.py:305-311). - A push without an
X-Registry-Authheader uses the service's own auth file (Podmanpkg/auth/auth.go:30-61,compat/images_push.go:82-95), sopodman logincoversdevops docker push. - Podman advertises compat API 1.44 (Podman
version/version.go:42-45), one below docker-py's default of 1.45. docker-py asks the server for its version on connect (docker-pyapi/client.py:203-207).
Gaps on Podman and other rootless engines:
- Rootless engines get the wrong sandbox user.
--rootless, the default, sendsuser=f"{uid}:{gid}"(sandbox/engine.py:80-84,docker/sandbox.py:260-264). Under rootful Docker that is the host user.- Under rootless Podman or rootless Docker, container UID 1000 maps to a subordinate host UID, so the sandbox cannot write its rw workspace.
- Podman's
keep-idcannot be sent: docker-py refuses anyuserns_modeother than"host"before the request (docker-pytypes/containers.py:551-556). - The subordinate UID is also what keeps a rootless sandbox out of the user's
0700runtime directory today, where the user's engine socket and session bus live. Mapping the sandbox to the host user removes that barrier, so fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115's workspace check must be in place first.
- CPU percentages are wrong on Podman.
container_statsasks forstream=False(docker/engine.py:341). Podman fills the CPU baseline only when streaming (Podmancompat/containers_stats.go:62-67), so_cpu_percentage(docker/engine.py:52-65) divides lifetime totals.- The first streamed frame (
docker/engine.py:356-363) covers almost no time on Podman and has no baseline on Docker.
- The build cache is Docker-only.
devops docker cachereadsBuildCachefromdf(docker/engine.py:522-525), and Podman always returns it empty (Podmancompat/system.go:113).--prunecallsprune_builds(docker/engine.py:530). Podman has no/build/pruneroute, only/build(Podmanpkg/api/server/register_images.go:781), so the call fails with a 404.
- Child processes and the devcontainer bypass the chosen endpoint.
_wait_for_docker_daemonneeds adockerbinary and runsdocker info(commands/devcontainer.py:935-946).dive <image>(security/dive.py:89-91) uses dive's default Docker source. That source readsDOCKER_HOSTor/var/run/docker.sock, not the endpoint the engine chose.- Child processes do not get
XDG_RUNTIME_DIR(allowlist atcore/process.py:27-77), and rootlesspodman loginstores its credentials under that directory. When no Dockerconfig.jsonis found, cosign's keychain looks there (go-containerregistrypkg/authn/keychain.go:109-137), sodevops docker signandverifymiss those credentials.REGISTRY_AUTH_FILEis dropped by the*AUTH*deny pattern (core/process.py:92).
Out of scope. The first three end in a one-line error that says what to set or run:
- Named Podman connections (
CONTAINER_CONNECTION,podman system connection). - Remote Podman over ssh. Podman's ssh URIs carry a socket path, and docker-py's
parse_hostrefuses a path on ssh (docker-pyutils/utils.py:280-283). - Podman machines on macOS and Windows. No local socket is found, so the Docker default is dialled and its error says what to set.
REGISTRY_AUTH_FILEfor cosign. The*AUTH*deny pattern is a secrets filter and stays as it is; the defaultpodman loginfile is covered.- minikube's driver:
commands/k8s/cluster_runtime.py:90-103keeps--driver=docker. - cgroup reads by Docker scope name (
sandbox/metrics.py:290-291). On Podman, the Engine API fallback (:236-245) already applies. - Renaming the command group (see key questions).
- The sandbox workspace check, which fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115 fixes, and
devops docker prune, which fails on every engine and is fixed by fix(cli):devops docker pruneremoves stopped containers, unused networks and dangling images instead of failing on every engine #1116.
Acceptance criteria
- Endpoint table, parametrised and offline.
- Test setup:
CONTAINER_HOST,CONTAINER_CONNECTION,DOCKER_HOST,DOCKER_CONTEXT,DOCKER_TLS_VERIFYandDOCKER_CERT_PATHare unset.DOCKER_CONFIG,HOMEandXDG_RUNTIME_DIRpoint undertmp_path, and so do the rootful socket path and the/run/userbase (both patched).- Socket stand-ins are empty files.
docker.DockerClientis patched.- Only TEST-NET and loopback literals are used.
- With nothing set and no files, the client gets
http+unix:///var/run/docker.sock, as in fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108. - A rootless Podman file gives
http+unix://<tmp>/podman/podman.sock. WithXDG_RUNTIME_DIRunset, the patched/run/user/<uid>path is used. - The rootful file alone is used when
os.accessallows read and write, and skipped otherwise. - With both Podman files present, the rootless one wins.
CONTAINER_HOST=unix:///<tmp>/custom.sockbeatsDOCKER_HOSTand both files.DOCKER_HOST,DOCKER_CONTEXTand a non-defaultcurrentContexteach beat the Podman files.currentContext: defaultdoes not.DOCKER_CONTEXTnaming a context that does not exist is a configuration error, and no client is built.CONTAINER_CONNECTION=dev, with or withoutCONTAINER_HOST, is a configuration error that namesCONTAINER_HOST, and no client is built.CONTAINER_HOST=ssh://[email protected]:22/run/user/1000/podman/podman.sockgives a one-line error. No client is built and no ssh process starts.CONTAINER_HOST=TCP://192.0.2.1:2375is refused by fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108's check, as the same value inDOCKER_HOSTis.- Every endpoint error exits 1 with one line that names the source:
CONTAINER_HOST,DOCKER_HOST, the context name or the socket path. - When Docker's default context was chosen and the dial fails, that line also says to set
CONTAINER_HOSTorDOCKER_HOST, or to runsystemctl --user enable --now podman.socket. - Only one endpoint is ever dialled. A failure on the chosen endpoint is reported; no other endpoint is tried.
- Test setup:
- Contract rows. fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108's
parse_hostcontract test gains two rows:unix:///run/user/1000/podman/podman.sock→http+unix:///run/user/1000/podman/podman.sock;- the ssh URI above raises
DockerException.
- Engine facts.
- The engine reports its kind: Podman when
version()["Components"]has a component namedPodman Engine(Podmancompat/version.go:35-36), Docker otherwise. - It reports rootless when
info()["SecurityOptions"]containsname=rootless(Podmancompat/info.go:197-198; rootless Docker reports the same). - Each fact is fetched once per engine instance.
- Tests use minimal
versionandinfofixtures with the fields the Podman handlers set and the fields Docker sets.
- The engine reports its kind: Podman when
- The sandbox workspace check follows the new sources. fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115's check takes the engine socket from the resolve step, so it covers the sources this item adds. With
CONTAINER_HOST=unix://<d>/custom.sockundertmp_path, a workspace of<d>is refused. With only the rootful Podman file present (its path patched undertmp_path), a workspace that holds it is refused. - User mapping.
- With a rootless engine (mocked
info()), both sandbox paths senduser="0:0". With a rootful engine, both senduid:gidas today.rootless=False(--rootondevops docker sandboxanddevops test) sends nouseron either path. - A dry run does not connect to the engine. It shows
uid:gidas today, with a note that a rootless engine runs the sandbox as container root, which is the host user. - Apart from
user, the create kwargs for Podman and Docker are identical, pinned by a test, so there is one dialect.
- With a rootless engine (mocked
- Stats.
container_statsreads the second frame of a streamed sample and closes the stream.stream_container_statsdrops the first frame.- A two-frame fixture whose first frame has empty
precpu_statsyields the CPU percentage of the second frame.
- Build cache. On a Podman engine,
devops docker cacheexits 1 with or without--prune, prints the message from the key questions and makes noprune_buildscall. Docker behaviour is unchanged. - Child processes and the devcontainer.
_wait_for_docker_daemonpollsget_engine().ping()and needs nodockerbinary.- When the engine's endpoint did not come from
DOCKER_HOST, dive runs withDOCKER_HOSTset to that endpoint as its source gave it. A test asserts the env passed torun_subprocess. - The cosign calls in
devops docker signandverifypassextra_allowed_env={"XDG_RUNTIME_DIR"}, and a test asserts the env passed torun_subprocess. XDG_RUNTIME_DIRis not added toDEFAULT_ALLOWED_ENV_VARS:- D-Bus clients fall back to
$XDG_RUNTIME_DIR/buswhenDBUS_SESSION_BUS_ADDRESSis unset (tests/conftest.py:308); - the session bus reaches gnome-keyring;
- devops-cli passes the bus only per call (
commands/devcontainer.py:1452,:1522).
- D-Bus clients fall back to
- Docs and release.
docs/cheatsheets/docker.mdgives:- the endpoint order;
- how to start Podman's user socket (
systemctl --user enable --now podman.socket); - the out-of-scope limits.
docs/commands/docker.mdis generated from help text and is not edited by hand. It is regenerated withdevops docs generate, and the docs check passes.- The knowledge base page
docker.mdsays devops-cli looks for Podman's socket before Docker's default. DEFAULT_CONTAINER_ENGINEandBIN_DOCKERare deleted.- A changelog.d fragment describes the endpoint order and the rootless user mapping.
- Tests are offline and never build a real
DockerClient, since connecting asks the server for its version. The new tests take well under 1 s together, anduv run devops cipasses.
- Pending a person: on a host running rootless Podman with
podman.socketenabled and noDOCKER_HOST, run each of these and record the results in the task file:devops docker images,build,push(afterpodman login),stats,prune,cache,analyze-layers,signandverify;- a
devops docker sandboxthat writes to an rw workspace (the files must be owned by the host user); devops sandbox deploy --network sandbox_namespace;- the dashboard's Docker panel.
- Pending a person: on that host, record the delegated cgroup controllers (
cat /sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers), and whether the sandbox's memory, CPU and PID limits take effect. - Pending a person: capture
/version,/infoand two stats frames from that service. Confirm the test fixtures carry the same fields. Host-specific values are removed before anything is committed. - Pending a person: on that host, confirm that
devops docker sandbox --workspace "$XDG_RUNTIME_DIR" -- trueis still refused by fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115's check once the sandbox runs as the host user.
Key questions
-
Which lands first, this item or fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108? Proposed: fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108.
- fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108 replaces the hand-written endpoint code with docker-py's gather, normalise, check and build steps.
- This item then adds sources to the gather step, so every new source passes the same egress check by construction.
- fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108 must then cover the following:
-
One ordered list of sources. It gathers through
DOCKER_HOST, thenDOCKER_CONTEXT, then acurrentContextother thandefault, then the default context. This replaces a singlekwargs_from_envcall plus asetdefaultmerge. This item can then putCONTAINER_HOSTfirst and the Podman sockets before the default context, without touching the normalise, check or build steps. fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108's endpoint table does not change.- The
DOCKER_CONTEXTsource looks the name up withContextAPI.get_context(name), whoseNonemeans the context does not exist.kwargs_from_contextreturns{}both for a missing context and for one with no host, so this item could not otherwise make a missing context an error. - The TLS parameters from
kwargs_from_envstill apply when the endpoint comes from a later source, asfrom_env's merge does today.
- The
-
A public resolve step that does not connect.
resolve_hoststays public. It returns:- the endpoint as its source gave it (dive needs this form, because Go's Docker client does not accept
http+unix://); - the normalised URL, and the docker-py parameters the client is built from;
- the name of its source.
fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115's workspace check, dive and the error messages reuse it.
- the endpoint as its source gave it (dive needs this form, because Go's Docker client does not accept
-
One shared fixture for the endpoint-table environment. This item extends it with
CONTAINER_HOST,CONTAINER_CONNECTION,XDG_RUNTIME_DIRand the Podman socket paths, so fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108's unset-default row stays correct on a host that runs Podman.
-
- fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108's ssh row and its dashboard change stay as fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108 states them.
-
Which client library? Proposed: docker-py 7.2.0 only, against Podman's Docker-compatible API.
- podman-py 5.8.0 cannot reach Docker. Its managers use the
/libpod/prefix by default (podman-pypodman/api/client.py:172); only a few calls, such aslogin, take the compat prefix (podman/domain/system.py:83). It has no https scheme (podman/api/client.py:94-101). - It does not accept devops-cli's create kwargs (podman-py
podman/domain/containers_create.py):tmpfsis unsupported (:518);nano_cpusis dropped (:475);security_optbecomes SELinux options (:636);- a network name becomes an invalid netns mode (
:884).
- Its network calls use libpod's lowercase
internalkey (the create body atpodman/domain/networks_manager.py:66).ensure_internal_networkreads Docker'sInternal(docker/engine.py:483). - Its classifiers stop at Python 3.13 (
setup.cfg:21-25), althoughrequires_pythonis only>=3.9. Its last release was 5.8.0 on 2026-03-25, before Podman 6.0.0 (2026-06-24). - Its ssh transport turns off host-key checking (
podman/api/ssh.py:66). - Using both SDKs doubles the create dialect, the projections, the discovery and the test fakes. The only gain is remote Podman over ssh. If that need arrives, a podman-py backend can sit behind the same engine interface.
- podman-py 5.8.0 cannot reach Docker. Its managers use the
-
In what order are endpoints chosen? Proposed: the first source that is set wins:
CONTAINER_CONNECTIONset: configuration error. Podman ranks it aboveCONTAINER_HOST(Podmancmd/podman/root.go:231-249), and devops-cli reads no connection files.CONTAINER_HOST.DOCKER_HOST, with docker-py's TLS variables.DOCKER_CONTEXT.- A
currentContextother thandefault. $XDG_RUNTIME_DIR/podman/podman.sock(/run/user/<uid>/podman/podman.sockwhen the variable is unset), if it exists./run/podman/podman.sock, if it exists and is readable and writable.- Docker's default context.
Explicit settings beat discovered sockets, and a discovered Podman socket beats Docker's default. In the devcontainer (docker-in-docker, no Podman socket) nothing changes.
-
Does devops-cli read Podman's configuration? Proposed: no.
- docker-py has no reader for containers.conf
service_destinationsorpodman-connections.json, and writing one by hand is what the library-first rule forbids. - A user with a named connection sets
CONTAINER_HOSTto its URI, as listed bypodman system connection list.
- docker-py has no reader for containers.conf
-
How does a rootless sandbox map the user? Proposed: on an engine that reports
name=rootless, senduser="0:0".- On a rootless engine, container root is the host user, which is what
--rootlesspromises ("Run container with host user UID/GID",commands/docker.py:479). - Omitting
userwould not do this: the process would run as the image'sUSER, so an image with a non-rootUSERwould again get a subordinate UID and fail to write the workspace. - All capabilities stay dropped and
no-new-privilegesstays set, as today. - Rootful engines keep
uid:gid. - The sandbox can then enter directories the host user owns, including the user's runtime directory with its engine socket and session bus. fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115's workspace check refuses those directories, which is why it lands first.
- On a rootless engine, container root is the host user, which is what
-
What does
devops docker cachedo on Podman? Proposed: it exits 1 with "Podman keeps no BuildKit cache; its build layers are images, anddevops docker pruneremoves the dangling ones." No/build/prunerequest is sent. -
Does this item rename the command group? Proposed: no. This item keeps
devops dockerso that its diff stays reviewable.- A rename to
devops container, with no alias, would be an item of its own.devops tfis the precedent: it runs OpenTofu first under a neutral name (commands/tf.py:51-61). - That item would also rename:
- the
devops_cli.dockerpackage; - the MCP tools
docker_stats,docker_sign,docker_verifyanddocker_sandbox(ai/mcp/server.py:505,:514,:552,:1317); - the
HELP,ERRORSandMESSAGESdockernamespaces; - about 100 references in docs and tests.
- the
- Whether to file that item does not change this one.
- A rename to
-
Do ssh endpoints work? Proposed: no change from fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108. They stay outside the egress check and are refused before any I/O because paramiko is not installed. This item does not pass
use_ssh_client=True.
Strategic alignment
- Owner preference. Podman over Docker, in the same way OpenTofu comes before Terraform and Valkey before Redis.
- Priority P2.
- Outside the devcontainer, the maintainer's workstation cannot use container commands without a hand-set
DOCKER_HOST. - Rootless sandboxes cannot write their workspace.
- Outside the devcontainer, the maintainer's workstation cannot use container commands without a hand-set
- Library first.
- No new dependency.
- docker-py's
kwargs_from_env,ContextAPIandparse_host, adopted by fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108, read and parse every endpoint. - The Podman sockets are the two documented paths, checked for existence.
- The engine kind and rootless mode come from the engine's own
version()andinfo(). - There is no containers.conf or connections-file parsing, no prefix test and no regex.
- Size: medium, one PR. It covers endpoint sources, engine facts, user mapping, stats, the build-cache message, child-process endpoints and docs.
- Dependencies.
- Lands after fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115. Its user-mapping change makes a socket in a mounted runtime directory reachable from a rootless sandbox, so the workspace check must already refuse those directories.
- Lands after fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108, which must first cover the three points in the key questions.
- Proposed milestone: backlog (P2), picked by the release-start fill.
- Related:
- fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115: the workspace check this item relies on.
- fix(cli):
devops docker pruneremoves stopped containers, unused networks and dangling images instead of failing on every engine #1116: makesdevops docker prunework on every engine. This item's build-cache message points to that command, and its person step runs it. - fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115 lands before this item.
- feat(cli): sandbox enforcement audit declared vs engine vs enforced (
devops sandbox audit) #698: the sandbox enforcement audit (whichever of this item and feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698's PR1 lands first addsDockerEngineService.security_options(); the other reuses it). It notes that the maintainer's host runs rootless Podman, and its ENGINE tests mockinfo(). Its PR1 plansDockerEngineService.security_options()overinfo()["SecurityOptions"]. This item adds that accessor under that name and readsname=rootlessfrom it, so the two items share oneinfo()read. - feat(cli): docker engine socket api, layer caching introspection & container sandbox optimization research #308: the Engine API socket layer this item extends.
Update 2026-10-08: refinement
No code reads CONTAINER_HOST. #1115 landed: feeding configured_host() (docker/engine.py:233-262) covers the workspace check, and /run and $XDG_RUNTIME_DIR are already refused (sandbox/engine.py:156-161). #1108 lands first. Mapping to the host user also exposes the SSH agent's 0700 directory, so #1384 (v0.2.30) lands first too.
- The person-run check expects a workspace holding the
SSH_AUTH_SOCKdirectory to be refused.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Linked: #698. Both plan
DockerEngineService.security_options(); whichever lands first adds it, and the other reuses it. Found by the 2026-10-08 backlog review.dan-petty-bot commentedon Oct 10, 2026
Moved to v0.2.34: v0.2.34 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)
feat(docker): container commands find Podman engine and rootless sand…
dan-petty commentedon Oct 11, 2026
Merged
feat(release): v0.2.34 (#1566)