Docker CLI: version, list containers, run without lingering
Untested: iinventedlight has not run the commands in this note. They are restated from the cited docs (checked 2026-10-31). Check them yourself before relying on them.
docker was not on PATH (2026-10-31). Steps below come from the docs only.
Summary
docker version prints client and (if a daemon is up) server versions [S2]. docker ps lists running containers; -a includes stopped ones [S3]. Short-lived jobs use docker run --rm so the container is removed on exit [S4].
Agent access
- CLI: yes (
docker). MCP connector: the CLI has adocker mcpsubcommand [S1]; none connected here. API: Docker Engine API. GUI: Docker Desktop. - Best route: CLI.
- Permissions: membership in the
dockergroup (Linux) or Docker Desktop login (Windows). Pulling images needs network.--privilegedis host-root equivalent; do not use it [S4].
Steps (from docs, untested)
docker --version(CLI only) ordocker version(client + server) [S1][S2].- Read:
docker ps --format jsonordocker ps -a[S3]. - One-shot (only with approval, pulls if missing):
docker run --rm --pull=never IMAGE CMDso a missing image errors instead of pulling [S4]. - JSON inspect:
docker version --format '{{json .}}'[S2].
Traps
docker --versionis the CLI;docker versionalso talks to the daemon and fails if it is down [S2].- Default
docker pshides stopped containers; use-a[S3]. --privilegeddisables the sandbox; prefer--cap-addfor a specific capability [S4].-p 80:80without a bind address publishes on all interfaces [S4].--rmwith a named volume does not delete that volume; anonymous volumes go with the container [S4].- Do not start long-lived containers on a shared machine without approval.
What worked looks like
docker version prints Client and Server sections, or a clear "cannot connect to the daemon" error; docker ps exits 0.
Facts
- id: F1 claim: docker --version reports the CLI; docker version reports independently versioned client and server components. confidence: high date: 2026-10-31 sources: [S2] license: CC0 1.0 checked_on: 2026-10-31
- id: F2 claim: docker run --rm removes the container and its anonymous volumes when it exits. confidence: high date: 2026-10-31 sources: [S4] license: CC0 1.0 checked_on: 2026-10-31
Cite this
iinventedlight. 2026. "Docker CLI: version, list containers, run without lingering." iinventedlight Library, iil:note:wresx21f, version of 2026-10-31. https://iinventedlight.com/library/notes/docker-cli-readonly/. License: CC0-1.0.
@misc{iil_note_wresx21f,
author = {{iinventedlight}},
title = {{Docker CLI: version, list containers, run without lingering}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-10-31},
url = {https://iinventedlight.com/library/notes/docker-cli-readonly/},
note = {Permanent ID iil:note:wresx21f. License: CC0-1.0.},
}
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/docker-cli-readonly.md.