removeContainer method

Future<void> removeContainer(
  1. String id, {
  2. bool force = false,
  3. bool removeVolumes = false,
})

Removes a container.

Parameters:

  • id — container ID or name.
  • force — force removal even if the container is running (sends SIGKILL first). Default: false.
  • removeVolumes — also remove anonymous volumes attached to the container. Default: false.

Implementation

Future<void> removeContainer(
  String id, {
  bool force = false,
  bool removeVolumes = false,
}) async {
  final resp = await _request(
    'DELETE',
    '/containers/$id',
    queryParams: {
      'force': force.toString(),
      'v': removeVolumes.toString(),
    },
  );
  if (resp.statusCode != 204) {
    _throwIfError(resp);
  }
}