containerLogs method

Stream<DockerLogLine> containerLogs(
  1. String id, {
  2. bool follow = false,
  3. int? tail,
})

What the container id prints, line by line, standard output and error together.

Without follow the stream ends after what was printed so far (the last tail lines when given); with it, it goes on until the container stops or the subscription is cancelled. The multiplexed frames of the daemon are split back into lines, per channel.

Implementation

Stream<DockerLogLine> containerLogs(
  String id, {
  bool follow = false,
  int? tail,
}) async* {
  final response = await _send(
    'GET',
    '/containers/$id/logs',
    query: {
      'stdout': '1',
      'stderr': '1',
      if (follow) 'follow': '1',
      if (tail != null) 'tail': '$tail',
    },
  );
  yield* _demultiplex(response);
}