public async Task <ContainerStatusResponse> GetContainerStatusAsync(Container container)
        {
            var response = await _clientManager.InspectContainerAsync(container.DockerId);

            if (response.Success)
            {
                return(new ContainerStatusResponse(response, response.DockerResponse));
            }

            return(new ContainerStatusResponse(response));
        }
Ejemplo n.º 2
0
        public static async Task<bool> WaitForContainerToStopAsync(
            string containerId,
            DockerClientManager clientManager,
            ILogger logger
        )
        {
            return await RetryHelper.RetryTask(async r =>
            {
                var response = await clientManager.InspectContainerAsync(containerId);

                if (!response.DockerResponse.State.Running)
                {
                    return true;
                }

                logger.LogInformation($"Waiting for container {containerId} to stop (retry {r})");

                return false;
            }, 30, TimeSpan.FromSeconds(1));
        }