aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-11 10:10:02 +0000
committerGitHub <noreply@github.com>2022-07-11 10:10:02 +0000
commit3691c9b1ba8e63f56b5cc36cdb1670fcfbdba0a1 (patch)
tree43e440d6630e4196b9a0b72fb1ab511ea3c600ec /docs
parent76422ecdbbd26bf645b664ea7663e5ecf10139ba (diff)
parent25d74db4555b5c22eab676594b0721c2579c719f (diff)
downloadpodman-3691c9b1ba8e63f56b5cc36cdb1670fcfbdba0a1.tar.gz
podman-3691c9b1ba8e63f56b5cc36cdb1670fcfbdba0a1.tar.bz2
podman-3691c9b1ba8e63f56b5cc36cdb1670fcfbdba0a1.zip
Merge pull request #14887 from eriksjolund/podman_info_command_completion_doc
[CI:DOCS] podman-info.1.md: update examples (now also shell completion and jq)
Diffstat (limited to 'docs')
-rw-r--r--docs/source/markdown/podman-info.1.md72
1 files changed, 66 insertions, 6 deletions
diff --git a/docs/source/markdown/podman-info.1.md b/docs/source/markdown/podman-info.1.md
index fc2d0fa60..28e4f3291 100644
--- a/docs/source/markdown/podman-info.1.md
+++ b/docs/source/markdown/podman-info.1.md
@@ -24,9 +24,10 @@ Show additional information
Change output format to "json" or a Go template.
-## EXAMPLE
+## EXAMPLES
+
+Run `podman info` for a YAML formatted response:
-Run podman info with plain text response:
```
$ podman info
host:
@@ -149,7 +150,9 @@ version:
OsArch: linux/amd64
Version: 4.0.0
```
-Run podman info with JSON formatted response:
+
+Run `podman info --format json` for a JSON formatted response:
+
```
$ podman info --format json
{
@@ -289,11 +292,68 @@ $ podman info --format json
}
}
```
-Run podman info and only get the registries information.
+
+#### Extracting the list of container registries with a Go template
+
+If shell completion is enabled, type `podman info --format={{.` and then press `[TAB]` twice.
+
+```
+$ podman info --format={{.
+{{.Host. {{.Plugins. {{.Registries}} {{.Store. {{.Version.
+```
+
+Press `R` `[TAB]` `[ENTER]` to print the registries information.
+
+```
+$ podman info -f {{.Registries}}
+map[search:[registry.fedoraproject.org registry.access.redhat.com docker.io quay.io]]
+$
+```
+
+The output still contains a map and an array. The map value can be extracted with
+
+```
+$ podman info -f '{{index .Registries "search"}}'
+[registry.fedoraproject.org registry.access.redhat.com docker.io quay.io]
+```
+
+The array can be printed as one entry per line
+
+```
+$ podman info -f '{{range index .Registries "search"}}{{.}}\n{{end}}'
+registry.fedoraproject.org
+registry.access.redhat.com
+docker.io
+quay.io
+
```
-$ podman info --format={{".Registries"}}
-map[registries:[docker.io quay.io registry.fedoraproject.org registry.access.redhat.com]]
+
+#### Extracting the list of container registries from JSON with jq
+
+The command-line JSON processor [__jq__](https://stedolan.github.io/jq/) can be used to extract the list
+of container registries.
+
```
+$ podman info -f json | jq '.registries["search"]'
+[
+ "registry.fedoraproject.org",
+ "registry.access.redhat.com",
+ "docker.io",
+ "quay.io"
+]
+```
+
+The array can be printed as one entry per line
+
+```
+$ podman info -f json | jq -r '.registries["search"] | .[]'
+registry.fedoraproject.org
+registry.access.redhat.com
+docker.io
+quay.io
+```
+
+Note, the Go template struct fields start with upper case. When running `podman info` or `podman info --format=json`, the same names start with lower case.
## SEE ALSO
**[podman(1)](podman.1.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)**, **[containers-storage.conf(5)](https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md)**