Using the Docker.Dotnet SDK, and using an image that succeeds when created via Docker Compose, I create and start the container, get no warnings or errors, but then I see the container 'exited' right away. I am looking for the minimal code needed to create and start a container via the Docker API (with any SDK or just the end points). Thanks
var exposedPorts = new Dictionary<string, EmptyStruct>();
exposedPorts.Add(recorderHttpPort, new EmptyStruct());
var createResponse = await client.Containers.CreateContainerAsync(new CreateContainerParameters()
{
Image = recorderImage.ID,
Name = containerName,
ExposedPorts = exposedPorts,
HostConfig = new HostConfig()
{
DNS = new[] { $"0.0.0.0:{recorderHttpPort}" }
}
}); ;
Just figured out that needed to add an entry point: "tail -f /dev/null". The container now finally starts.