Docker.DotNet
Docker.DotNet copied to clipboard
How to get service logs using the service id?
According to the Docker Engine API (https://docs.docker.com/engine/api/v1.40/#operation/ServiceLogs) I should be able to get the service logs but I can't see anything in Docker.Dotnet to allow me to do it. I have written some code that will create a service (see below) which returns the service id but nothing in the client to allow me to bring back the service logs using it. We have _client.Containers.GetContainerLogsAsync, but do we have the equivalent of _client.Services.GetServiceLogsAsync?
var serviceCreateResponse = await _client
.Swarm
.CreateServiceAsync(new ServiceCreateParameters
{
Service = new ServiceSpec
{
Name = Guid.NewGuid().ToString().Replace("-", string.Empty),
TaskTemplate = new TaskSpec
{
ContainerSpec = new ContainerSpec
{
Image = DukaanDatabaseImage,
Env = new List<string>
{
"POSTGRES_PASSWORD_FILE=/run/secrets/db_postgres_user_password",
"POSTGRES_INITDB_ARGS=--data-checksums"
}
}
},
EndpointSpec = new EndpointSpec
{
Ports = new List<PortConfig>
{
new PortConfig
{
PublishedPort = port,
TargetPort = 5432
}
}
}
}
})
var serviceId = serviceCreateResponse.ID
Same problem