summaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
authorflouthoc <flouthoc.git@gmail.com>2021-07-29 16:25:18 +0530
committerflouthoc <flouthoc.git@gmail.com>2021-07-30 19:31:05 +0530
commit2a484e782a23ad67c98e22121fde2b83b4072d1a (patch)
tree4691b5c19020ec9281bda7e58dee88e6d63d753f /libpod/runtime_ctr.go
parentf17b810279fd04c3d574e8d3dcc1878d50083a68 (diff)
downloadpodman-2a484e782a23ad67c98e22121fde2b83b4072d1a.tar.gz
podman-2a484e782a23ad67c98e22121fde2b83b4072d1a.tar.bz2
podman-2a484e782a23ad67c98e22121fde2b83b4072d1a.zip
ps: support the container notation for ps --filter network=...
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index ce4c5d758..31e2d09ce 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -894,6 +894,18 @@ func (r *Runtime) LookupContainer(idOrName string) (*Container, error) {
return r.state.LookupContainer(idOrName)
}
+// LookupContainerId looks up a container id by its name or a partial ID
+// If a partial ID is not unique, an error will be returned
+func (r *Runtime) LookupContainerID(idOrName string) (string, error) {
+ r.lock.RLock()
+ defer r.lock.RUnlock()
+
+ if !r.valid {
+ return "", define.ErrRuntimeStopped
+ }
+ return r.state.LookupContainerID(idOrName)
+}
+
// GetContainers retrieves all containers from the state
// Filters can be provided which will determine what containers are included in
// the output. Multiple filters are handled by ANDing their output, so only