stopContainer method

Future<void> stopContainer(
  1. String id, {
  2. Duration? timeout,
})

Stops the container id: its process gets SIGTERM, and SIGKILL after timeout (the daemon's default, 10 seconds, when null). A container that does not exist is not an error.

Implementation

Future<void> stopContainer(String id, {Duration? timeout}) => _ignoreMissing(
  () async {
    await _drain(
      await _send(
        'POST',
        '/containers/$id/stop',
        query: {if (timeout != null) 't': '${timeout.inSeconds}'},
      ),
    );
  },
);