Find and remove Docker containers left behind by a previous Agentics runner process, with a dry run first and a confirmation before anything is deleted.
pks agentics runner cleanup [options]$ pks agentics runner cleanup --dry-runList removal candidates without removing them
$ pks agentics runner cleanupRemove orphans after a confirmation prompt
$ pks agentics runner cleanup --yesRemove orphans without prompting
$ pks agentics runner cleanup --allRemove every pks.agentics container, live or not
Restarting the runner strands its containers. Each spawned container is bound to the runner process that created it through a pks.agentics.runner-instance label, and its bind mounts point at temp directories the new process does not share — so the old containers can never be reused. runner cleanup finds them and removes them.
docker CLI on PATH with a reachable daemon. If listing containers fails, the command aborts with exit code 1 rather than reporting zero containers.Always start with a dry run.
pks agentics runner cleanup --dry-run
The command lists every container carrying the pks.agentics.fingerprint label, running or stopped, and marks which ones it considers orphaned.
There is no out-of-band registry of live runner-instance ids, so liveness is approximated: the command looks for a running pks-cli agentics runner start process with pgrep.
pks agentics runner cleanup
You are asked Remove N container(s)?, defaulting to No, then each candidate is removed with docker rm -f. To skip the prompt in a script:
pks agentics runner cleanup --yes
--all bypasses the liveness heuristic and removes every pks.agentics.* container regardless of whether a runner is using it — including a container a running runner may reuse for a warm or in-flight job.
pks agentics runner cleanup --all --dry-run
Confirm the list first, then re-run without --dry-run.
docker ps -a --filter label=pks.agentics.fingerprint
You should see only containers belonging to a runner you intend to keep.
| Flag | Description |
|---|---|
-n, --dry-run | Show what would be removed without removing anything. |
-y, --yes | Skip the confirmation prompt. |
--all | Remove all pks.agentics.* containers, including those of currently-running runners. |
-v, --verbose | Enable verbose output. |
--all after checking a dry run.