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 will remove one or more containers from the host. The con‐
18 tainer name or ID can be used. This does not remove images. Running
19 or unusable containers will not be 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 --depend
33 Remove selected container and recursively remove all containers that
34 depend on it.
35
36
37 --filter=filter
38 Filter what containers remove. Multiple filters can be given with mul‐
39 tiple uses of the --filter flag. Filters with the same key work inclu‐
40 sive with the only exception being label which is exclusive. Filters
41 with different keys always work exclusive.
42
43
44 Valid filters are listed below:
45
46
47 ┌─────────┬───────────────────────────────┐
48 │Filter │ Description │
49 ├─────────┼───────────────────────────────┤
50 │id │ [ID] Container's ID (accepts │
51 │ │ regex) │
52 ├─────────┼───────────────────────────────┤
53 │name │ [Name] Container's name (ac‐ │
54 │ │ cepts regex) │
55 ├─────────┼───────────────────────────────┤
56 │label │ [Key] or [Key=Value] Label │
57 │ │ assigned to a container │
58 ├─────────┼───────────────────────────────┤
59 │exited │ [Int] Container's exit code │
60 ├─────────┼───────────────────────────────┤
61 │status │ [Status] Container's status: │
62 │ │ 'created', 'exited', │
63 │ │ 'paused', 'running', 'un‐ │
64 │ │ known' │
65 ├─────────┼───────────────────────────────┤
66 │ancestor │ [ImageName] Image or descen‐ │
67 │ │ dant used to create container │
68 ├─────────┼───────────────────────────────┤
69 │before │ [ID] or [Name] Containers │
70 │ │ created before this container │
71 ├─────────┼───────────────────────────────┤
72 │since │ [ID] or [Name] Containers │
73 │ │ created since this container │
74 ├─────────┼───────────────────────────────┤
75 │volume │ [VolumeName] or [Mountpoint‐ │
76 │ │ Destination] Volume mounted │
77 │ │ in container │
78 ├─────────┼───────────────────────────────┤
79 │health │ [Status] healthy or unhealthy │
80 ├─────────┼───────────────────────────────┤
81 │pod │ [Pod] name or full or partial │
82 │ │ ID of pod │
83 ├─────────┼───────────────────────────────┤
84 │network │ [Network] name or full ID of │
85 │ │ network │
86 └─────────┴───────────────────────────────┘
87
88 --force, -f
89 Force the removal of running and paused containers. Forcing a container
90 removal also removes containers from container storage even if the con‐
91 tainer is not known to podman. Containers could have been created by a
92 different container engine. In addition, forcing can be used to remove
93 unusable containers, e.g. containers whose OCI runtime has become un‐
94 available.
95
96
97 --ignore, -i
98 Ignore errors when specified containers are not in the container store.
99 A user might have decided to manually remove a container which would
100 lead to a failure during the ExecStop directive of a systemd service
101 referencing that container.
102
103
104 --latest, -l
105 Instead of providing the container name or ID, use the last created
106 container. If you use methods other than Podman to run containers such
107 as CRI-O, the last started container could be from either of those
108 methods. (This option is not available with the remote Podman client,
109 including Mac and Windows (excluding WSL2) machines)
110
111
112 --time, -t=seconds
113 Seconds to wait before forcibly stopping the container.
114
115
116 The --force option must be specified to use the --time option.
117
118
119 --volumes, -v
120 Remove anonymous volumes associated with the container. This does not
121 include named volumes created with podman volume create, or the --vol‐
122 ume option of podman run and podman create.
123
124
126 Remove container with a given name
127
128
129 $ podman rm mywebserver
130
131
132
133 Remove container with a given name and all of the containers that de‐
134 pend on it
135
136
137 $ podman rm --depend mywebserver
138
139
140
141 Remove multiple containers with given names or IDs
142
143
144 $ podman rm mywebserver myflaskserver 860a4b23
145
146
147
148 Remove multiple containers with IDs read from files
149
150
151 $ podman rm --cidfile ./cidfile-1 --cidfile /home/user/cidfile-2
152
153
154
155 Forcibly remove container with a given ID
156
157
158 $ podman rm -f 860a4b23
159
160
161
162 Remove all containers regardless of the run state
163
164
165 $ podman rm -f -a
166
167
168
169 Forcibly remove the last created container
170
171
172 $ podman rm -f --latest
173
174
175
177 0 All specified containers removed
178
179
180 1 One of the specified containers did not exist, and no other fail‐
181 ures
182
183
184 2 One of the specified containers is paused or running
185
186
187 125 The command fails for any other reason
188
189
191 podman(1), crio(8)
192
193
195 August 2017, Originally compiled by Ryan Cole rycole@redhat.com
196 ⟨mailto:rycole@redhat.com⟩
197
198
199
200 podman-rm(1)