IDockerClient.cs 1.0 KB

123456789101112131415161718192021
  1. namespace RackPeek.Domain.Discovery;
  2. /// <summary>Reads containers off a Docker Engine API. The IO half of docker discovery.</summary>
  3. public interface IDockerClient {
  4. /// <summary>Describes where this client is pointed, for error messages.</summary>
  5. string Endpoint { get; }
  6. /// <summary>
  7. /// Running containers only. A stopped container has no host port bindings — the
  8. /// daemon does not create them until it runs — so it can never be described as a
  9. /// Service, which makes listing stopped containers pointless here.
  10. /// </summary>
  11. Task<IReadOnlyList<DockerContainer>> ListContainersAsync(CancellationToken cancellationToken = default);
  12. /// <summary>
  13. /// The engine's own identity, or null when it cannot be read. Null is an expected
  14. /// answer, not an error: the read-only socket proxies the docs recommend usually
  15. /// allow <c>/containers</c> but block <c>/info</c>.
  16. /// </summary>
  17. Task<DockerEngineInfo?> GetInfoAsync(CancellationToken cancellationToken = default);
  18. }