1podman-rm(1) General Commands Manual podman-rm(1)
2
3
4
6 podman-rm - Remove one or more containers
7
8
10 podman rm [options] container
11
12
13 podman container rm [options] container
14
15
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
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 ┌─────────┬───────────────────────────────┐
51 │Filter │ 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 │until │ [DateTime] Containers created │
92 │ │ before the given duration or │
93 │ │ time. │
94 └─────────┴───────────────────────────────┘
95
96 --force, -f
97 Force the removal of running and paused containers. Forcing a container
98 removal also removes containers from container storage even if the con‐
99 tainer is not known to Podman. For example, containers that are cre‐
100 ated by different container engines like Buildah. In addition, forcing
101 can be used to remove unusable containers, e.g. containers whose OCI
102 runtime has become unavailable.
103
104
105 --ignore, -i
106 Ignore errors when specified containers are not in the container store.
107 A user might have decided to manually remove a container which leads to
108 a failure during the ExecStop directive of a systemd service referenc‐
109 ing that container.
110
111
112 Further ignore when the specified --cidfile does not exist as it may
113 have already been removed along with the container.
114
115
116 --latest, -l
117 Instead of providing the container name or ID, use the last created
118 container. Note: the last started container can be from other users of
119 Podman on the host machine. (This option is not available with the re‐
120 mote Podman client, including Mac and Windows (excluding WSL2) ma‐
121 chines)
122
123
124 --time, -t=seconds
125 Seconds to wait before forcibly stopping the container. Use -1 for in‐
126 finite wait.
127
128
129 The --force option must be specified to use the --time option.
130
131
132 --volumes, -v
133 Remove anonymous volumes associated with the container. This does not
134 include named volumes created with podman volume create, or the --vol‐
135 ume option of podman run and podman create.
136
137
139 Remove container with a given name
140
141 $ podman rm mywebserver
142
143
144
145 Remove container with a given name and all of the containers that de‐
146 pend on it
147
148 $ podman rm --depend mywebserver
149
150
151
152 Remove multiple containers with given names or IDs
153
154 $ podman rm mywebserver myflaskserver 860a4b23
155
156
157
158 Remove multiple containers with IDs read from files
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 $ podman rm -f 860a4b23
167
168
169
170 Remove all containers regardless of the run state
171
172 $ podman rm -f -a
173
174
175
176 Forcibly remove the last created container
177
178 $ podman rm -f --latest
179
180
181
183 0 All specified containers removed
184
185
186 1 One of the specified containers did not exist, and no other fail‐
187 ures
188
189
190 2 One of the specified containers is paused or running
191
192
193 125 The command fails for any other reason
194
195
197 podman(1)
198
199
201 August 2017, Originally compiled by Ryan Cole rycole@redhat.com
202 ⟨mailto:rycole@redhat.com⟩
203
204
205
206 podman-rm(1)