@@ -231,6 +231,47 @@ t DELETE images/test1:latest 200
231
231
232
232
t GET " images/get?names=alpine" 200 ' [POSIX tar archive]'
233
233
234
+ # START: Testing variance between Docker API and Podman API
235
+ # regarding force deleting images.
236
+ # Podman: Force deleting an image will force remove any
237
+ # container using the image.
238
+ # Docker: Force deleting an image will only remove non
239
+ # running containers using the image.
240
+
241
+ # Create new image
242
+ podman image build -t docker.io/library/test1:latest - << EOF
243
+ from alpine
244
+ RUN >file4
245
+ EOF
246
+
247
+ # Create running container
248
+ podman run --rm -d --name test_container docker.io/library/test1:latest top
249
+
250
+ # When using the Docker Compat API, force deleting an image
251
+ # shouldn't force delete any container using the image, only
252
+ # containers in a non running state should be removed.
253
+ # https://github.com/containers/podman/issues/25871
254
+ t DELETE images/test1:latest? force=true 409
255
+
256
+ # When using the Podman Libpod API, deleting an image
257
+ # with a running container will fail.
258
+ t DELETE libpod/images/test1:latest 409
259
+
260
+ # When using the Podman Libpod API, force deleting an
261
+ # image will also force delete all containers using the image.
262
+
263
+ # Verify container exists.
264
+ t GET libpod/containers/test_container/exists 204
265
+
266
+ # Delete image with force.
267
+ t DELETE libpod/images/test1:latest? force=true 200
268
+
269
+ # Verify container also removed.
270
+ t GET libpod/containers/test_container/exists 404
271
+
272
+ # END: Testing variance between Docker API and Podman API
273
+ # regarding force deleting images.
274
+
234
275
podman pull busybox
235
276
t GET " images/get?names=alpine&names=busybox" 200 ' [POSIX tar archive]'
236
277
img_cnt=$( tar xf " $WORKDIR /curl.result.out" manifest.json -O | jq " length" )
0 commit comments