containerInfo method

  1. @override
Future<ContainerInspectInfo?> containerInfo()
override

Returns detailed inspect information for this container.

The result is cached after the first successful call. Returns null when the container has not been started yet or the inspect call fails.

Implementation

@override
Future<ContainerInspectInfo?> containerInfo() async {
  if (_cachedContainerInfo != null) {
    return _cachedContainerInfo;
  }
  if (_containerId == null) {
    return null;
  }
  try {
    _cachedContainerInfo =
        await _dockerClient.containerInspectInfo(_requireContainerId);
  } catch (e, st) {
    stderr.writeln('testcontainers: error fetching container info: $e\n$st');
    _cachedContainerInfo = null;
  }
  return _cachedContainerInfo;
}