mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Add support for external container
External containers are containers created outside of Podman. For example Buildah and CRI-O Containers. $ buildah from alpine alpine-working-container $ buildah run alpine-working-container touch /test $ podman container exists --external alpine-working-container $ podman container diff alpine-working-container C /etc A /test Added --external flag to refer to external containers, rather then --storage. Added --external for podman container exists and modified podman ps to use --external rather then --storage. It was felt that --storage would confuse the user into thinking about changing the storage driver or options. --storage is still supported through the use of aliases. Finally podman contianer diff, does not require the --external flag, since it there is little change of users making the mistake, and would just be a pain for the user to remember the flag. podman container exists --external is required because it could fool scripts that rely on the existance of a Podman container, and there is a potential for a partial deletion of a container, which could mess up existing users. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
podman-container-exists - Check if a container exists in local storage
|
||||
|
||||
## SYNOPSIS
|
||||
**podman container exists** *container*
|
||||
**podman container exists** [*options*] *container*
|
||||
|
||||
## DESCRIPTION
|
||||
**podman container exists** checks if a container exists in local storage. The **ID** or **Name**
|
||||
@ -14,6 +14,9 @@ was an issue accessing the local storage.
|
||||
|
||||
## OPTIONS
|
||||
|
||||
**--external**=*true|false*
|
||||
Check for external containers as well as Podman containers. These external containers are generally created via other container technology such as Buildah or CRI-O.
|
||||
|
||||
**-h**, **--help**
|
||||
Print usage statement
|
||||
|
||||
@ -33,6 +36,13 @@ $ echo $?
|
||||
1
|
||||
```
|
||||
|
||||
Check if an container called `ubi8-working-container` created via Buildah exists in local storage (the container does not actually exist).
|
||||
```
|
||||
$ podman container exists --external ubi8-working-container
|
||||
$ echo $?
|
||||
1
|
||||
```
|
||||
|
||||
## SEE ALSO
|
||||
podman(1)
|
||||
|
||||
|
@ -34,70 +34,12 @@ all the containers information. By default it lists:
|
||||
|
||||
Show all the containers created by Podman, default is only running containers.
|
||||
|
||||
Note: Podman shares containers storage with other tools such as Buildah and CRI-O. In some cases these `external` containers might also exist in the same storage. Use the `--storage` option to see these external containers. External containers show the 'storage' status.
|
||||
Note: Podman shares containers storage with other tools such as Buildah and CRI-O. In some cases these `external` containers might also exist in the same storage. Use the `--external` option to see these external containers. External containers show the 'storage' status.
|
||||
|
||||
**--pod**, **-p**
|
||||
|
||||
Display the pods the containers are associated with
|
||||
|
||||
**--storage**
|
||||
**--external**
|
||||
|
||||
Display external containers that are not controlled by Podman but are stored in containers storage. These external containers are generally created via other container technology such as Buildah or CRI-O and may depend on the same container images that Podman is also using. External containers are denoted with either a 'buildah' or 'storage' in the COMMAND and STATUS column of the ps output. Only used with the --all option.
|
||||
|
||||
**--no-trunc**
|
||||
|
||||
Display the extended information
|
||||
|
||||
**--quiet**, **-q**
|
||||
|
||||
Print the numeric IDs of the containers only
|
||||
|
||||
**--format**=*format*
|
||||
|
||||
Pretty-print containers to JSON or using a Go template
|
||||
|
||||
Valid placeholders for the Go template are listed below:
|
||||
|
||||
| **Placeholder** | **Description** |
|
||||
| --------------- | ------------------------------------------------ |
|
||||
| .ID | Container ID |
|
||||
| .Image | Image Name/ID |
|
||||
| .ImageID | Image ID |
|
||||
| .Command | Quoted command used |
|
||||
| .CreatedAt | Creation time for container |
|
||||
| .RunningFor | Time elapsed since container was started |
|
||||
| .Status | Status of container |
|
||||
| .Pod | Pod the container is associated with |
|
||||
| .Ports | Exposed ports |
|
||||
| .Size | Size of container |
|
||||
| .Names | Name of container |
|
||||
| .Labels | All the labels assigned to the container |
|
||||
| .Mounts | Volumes mounted in the container |
|
||||
|
||||
**--sort**
|
||||
|
||||
Sort by command, created, id, image, names, runningfor, size, or status",
|
||||
Note: Choosing size will sort by size of rootFs, not alphabetically like the rest of the options
|
||||
Default: created
|
||||
|
||||
**--size**, **-s**
|
||||
|
||||
Display the total file size
|
||||
|
||||
**--last**, **-n**
|
||||
|
||||
Print the n last created containers (all states)
|
||||
|
||||
**--latest**, **-l**
|
||||
|
||||
Show the latest container created (all states)
|
||||
|
||||
The latest option is not supported on the remote client.
|
||||
|
||||
**--namespace**, **--ns**
|
||||
|
||||
Display namespace information
|
||||
|
||||
**--filter**, **-f**
|
||||
|
||||
Filter what containers are shown in the output.
|
||||
@ -120,10 +62,68 @@ Valid filters are listed below:
|
||||
| volume | [VolumeName] or [MountpointDestination] Volume mounted in container |
|
||||
| health | [Status] healthy or unhealthy |
|
||||
|
||||
**--format**=*format*
|
||||
|
||||
Pretty-print containers to JSON or using a Go template
|
||||
|
||||
Valid placeholders for the Go template are listed below:
|
||||
|
||||
| **Placeholder** | **Description** |
|
||||
| --------------- | ------------------------------------------------ |
|
||||
| .ID | Container ID |
|
||||
| .Image | Image Name/ID |
|
||||
| .ImageID | Image ID |
|
||||
| .Command | Quoted command used |
|
||||
| .CreatedAt | Creation time for container |
|
||||
| .RunningFor | Time elapsed since container was started |
|
||||
| .Status | Status of container |
|
||||
| .Pod | Pod the container is associated with |
|
||||
| .Ports | Exposed ports |
|
||||
| .Size | Size of container |
|
||||
| .Names | Name of container |
|
||||
| .Labels | All the labels assigned to the container |
|
||||
| .Mounts | Volumes mounted in the container |
|
||||
|
||||
**--help**, **-h**
|
||||
|
||||
Print usage statement
|
||||
|
||||
**--last**, **-n**
|
||||
|
||||
Print the n last created containers (all states)
|
||||
|
||||
**--latest**, **-l**
|
||||
|
||||
Show the latest container created (all states)
|
||||
|
||||
The latest option is not supported on the remote client.
|
||||
|
||||
**--namespace**, **--ns**
|
||||
|
||||
Display namespace information
|
||||
|
||||
**--no-trunc**
|
||||
|
||||
Display the extended information
|
||||
|
||||
**--pod**, **-p**
|
||||
|
||||
Display the pods the containers are associated with
|
||||
|
||||
**--quiet**, **-q**
|
||||
|
||||
Print the numeric IDs of the containers only
|
||||
|
||||
**--sort**
|
||||
|
||||
Sort by command, created, id, image, names, runningfor, size, or status",
|
||||
Note: Choosing size will sort by size of rootFs, not alphabetically like the rest of the options
|
||||
Default: created
|
||||
|
||||
**--size**, **-s**
|
||||
|
||||
Display the total file size
|
||||
|
||||
**--sync**
|
||||
|
||||
Force a sync of container state with the OCI runtime.
|
||||
@ -181,7 +181,7 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
|
||||
```
|
||||
|
||||
```
|
||||
$ podman ps --storage -a
|
||||
$ podman ps --external -a
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
69ed779d8ef9f redis:alpine "redis-server" 25 hours ago Created 6379/tcp k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
|
||||
38a8a78596f9 docker.io/library/busybox:latest buildah 2 hours ago storage busybox-working-container
|
||||
|
Reference in New Issue
Block a user