removeImage method

Future<void> removeImage(
  1. String imageId, {
  2. bool force = true,
  3. bool noPrune = false,
})

Removes an image from the local image cache.

Parameters:

  • imageId — full or short image ID, or name:tag.
  • force — remove even if the image is used by stopped containers. Default: true.
  • noPrune — do not delete untagged parent images. Default: false.

Implementation

Future<void> removeImage(
  String imageId, {
  bool force = true,
  bool noPrune = false,
}) async {
  final resp = await _request(
    'DELETE',
    '/images/$imageId',
    queryParams: {
      'force': force.toString(),
      'noprune': noPrune.toString(),
    },
  );
  if (resp.statusCode != 200 && resp.statusCode != 404) {
    _throwIfError(resp);
  }
}