1podman-rm(1)                General Commands Manual               podman-rm(1)
2
3
4

NAME

6       podman-rm - Remove one or more containers
7
8

SYNOPSIS

10       podman rm [options] container
11
12
13       podman container rm [options] container
14
15

DESCRIPTION

17       podman  rm removes one or more containers from the host.  The container
18       name or ID can be used.  This does not remove images.  Running or unus‐
19       able containers are not removed without the -f option.
20
21

OPTIONS

23   --all, -a
24       Remove all containers.  Can be used in conjunction with -f as well.
25
26
27   --cidfile=file
28       Read container ID from the specified file and rm the container.  Can be
29       specified multiple times.
30
31
32       Command does not fail when file is missing and user specified --ignore.
33
34
35   --depend
36       Remove selected container and recursively remove  all  containers  that
37       depend on it.
38
39
40   --filter=filter
41       Filter what containers remove.  Multiple filters can be given with mul‐
42       tiple uses of the --filter flag.  Filters with the same key work inclu‐
43       sive  with  the  only exception being label which is exclusive. Filters
44       with different keys always work exclusive.
45
46
47       Valid filters are listed below:
48
49
50       ┌─────────┬───────────────────────────────┐
51Filter   Description                   
52       ├─────────┼───────────────────────────────┤
53       │id       │ [ID] Container's ID (CID pre‐ │
54       │         │ fix match by default; accepts │
55       │         │ regex)                        │
56       ├─────────┼───────────────────────────────┤
57       │name     │ [Name] Container's name  (ac‐ │
58       │         │ cepts regex)                  │
59       ├─────────┼───────────────────────────────┤
60       │label    │ [Key]  or  [Key=Value]  Label │
61       │         │ assigned to a container       │
62       ├─────────┼───────────────────────────────┤
63       │exited   │ [Int] Container's exit code   │
64       ├─────────┼───────────────────────────────┤
65       │status   │ [Status] Container's  status: │
66       │         │ 'created',          'exited', │
67       │         │ 'paused',   'running',   'un‐ │
68       │         │ known'                        │
69       ├─────────┼───────────────────────────────┤
70       │ancestor │ [ImageName]  Image or descen‐ │
71       │         │ dant used to create container │
72       ├─────────┼───────────────────────────────┤
73       │before   │ [ID]  or  [Name]   Containers │
74       │         │ created before this container │
75       ├─────────┼───────────────────────────────┤
76       │since    │ [ID]   or  [Name]  Containers │
77       │         │ created since this container  │
78       ├─────────┼───────────────────────────────┤
79       │volume   │ [VolumeName] or  [Mountpoint‐ │
80       │         │ Destination]  Volume  mounted │
81       │         │ in container                  │
82       ├─────────┼───────────────────────────────┤
83       │health   │ [Status] healthy or unhealthy │
84       ├─────────┼───────────────────────────────┤
85       │pod      │ [Pod] name or full or partial │
86       │         │ ID of pod                     │
87       ├─────────┼───────────────────────────────┤
88       │network  │ [Network]  name or full ID of │
89       │         │ network                       │
90       └─────────┴───────────────────────────────┘
91
92   --force, -f
93       Force the removal of running and paused containers. Forcing a container
94       removal also removes containers from container storage even if the con‐
95       tainer is not known to Podman.  For example, containers that  are  cre‐
96       ated by different container engines like Buildah.  In addition, forcing
97       can be used to remove unusable containers, e.g.  containers  whose  OCI
98       runtime has become unavailable.
99
100
101   --ignore, -i
102       Ignore errors when specified containers are not in the container store.
103       A user might have decided to manually remove a container which leads to
104       a  failure during the ExecStop directive of a systemd service referenc‐
105       ing that container.
106
107
108       Further ignore when the specified --cidfile does not exist  as  it  may
109       have already been removed along with the container.
110
111
112   --latest, -l
113       Instead  of  providing  the  container name or ID, use the last created
114       container.  Note: the last started container can be from other users of
115       Podman on the host machine.  (This option is not available with the re‐
116       mote Podman client, including Mac  and  Windows  (excluding  WSL2)  ma‐
117       chines)
118
119
120   --time, -t=seconds
121       Seconds to wait before forcibly stopping the container.  Use -1 for in‐
122       finite wait.
123
124
125       The --force option must be specified to use the --time option.
126
127
128   --volumes, -v
129       Remove anonymous volumes associated with the container. This  does  not
130       include  named volumes created with podman volume create, or the --vol‐
131       ume option of podman run and podman create.
132
133

EXAMPLE

135       Remove container with a given name
136
137
138              $ podman rm mywebserver
139
140
141
142       Remove container with a given name and all of the containers  that  de‐
143       pend on it
144
145
146              $ podman rm --depend mywebserver
147
148
149
150       Remove multiple containers with given names or IDs
151
152
153              $ podman rm mywebserver myflaskserver 860a4b23
154
155
156
157       Remove multiple containers with IDs read from files
158
159
160              $ podman rm --cidfile ./cidfile-1 --cidfile /home/user/cidfile-2
161
162
163
164       Forcibly remove container with a given ID
165
166
167              $ podman rm -f 860a4b23
168
169
170
171       Remove all containers regardless of the run state
172
173
174              $ podman rm -f -a
175
176
177
178       Forcibly remove the last created container
179
180
181              $ podman rm -f --latest
182
183
184

Exit Status

186       0   All specified containers removed
187
188
189       1    One  of the specified containers did not exist, and no other fail‐
190       ures
191
192
193       2   One of the specified containers is paused or running
194
195
196       125 The command fails for any other reason
197
198

SEE ALSO

200       podman(1)
201
202

HISTORY

204       August  2017,  Originally  compiled  by  Ryan  Cole   rycole@redhat.com
205       ⟨mailto:rycole@redhat.com⟩
206
207
208
209                                                                  podman-rm(1)
Impressum