Add container info command#1769
Open
muk2 wants to merge 2 commits into
Open
Conversation
Implements issue apple#815: a top-level `container info` command (like `docker info`) that reports system-wide information so tools can use `container` as a drop-in via `ln -s container docker`. The command gathers, from real APIs only: - CLI version/build/commit (ReleaseVersion) - Host architecture, OS, CPU count (Arch / ProcessInfo) - API server status/version/build/commit and app/install/log roots (ClientHealthCheck) - Container counts (total/running) and image count when the daemon is up (ContainerClient.list / ClientImage.list) - Default registry domain, kernel binary path, container CPU/memory, builder image, init image, and DNS domain (ContainerSystemConfig) Supports the standard `--format table|json|yaml|toml` output flag used by other commands. Daemon-dependent sections are omitted gracefully when the API server is not running. Fixes apple#815
|
Nice addition, this looks like a useful I spotted one small bug in the image count path. In That means I think this can be fixed with: It may also be worth adding a small regression test around this path, either by making the gather dependencies injectable or by testing a focused helper, so the image count behavior is covered directly. |
The image count was assigned to a shadowed copy of the resource counts created by an `if var resources` binding, so it never reached the `InfoPayload` returned by `gather()`. As a result `images.total` was omitted from table and JSON output even when `ClientImage.list()` succeeded. Apply the count to the outer value via a small, pure `withImageCount` helper and add regression tests covering the count path.
|
@muk2 Are you going to add the |
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.
Summary
Adds a top-level
container infocommand — the analog ofdocker info— thatprints client, host, server, storage paths, resource counts, and default
settings in a table or as JSON (
--format json). Daemon-sourced fields populateonly when the API server responds, so the command degrades gracefully to a
"server not running" view when the daemon is stopped.
Testing
make checkpasses (formatting + license headers).SystemInfoTests(5 tests) cover table rendering with and withouta running server, JSON round-tripping, and omission of optional fields. All pass.
container infowith the daemon stopped shows client/host plusserver: not running; aftercontainer system start, server/paths/countspopulate;
container info --format json | jqemits valid JSON.Fixes #815