You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce the issue:
Just run below code as a ConsoleApp (ofc. you need docker deamon running):
using Docker.DotNet;
using Docker.DotNet.Models;
var dockerEngineUrl = new Uri("npipe://./pipe/docker_engine");
using var client = new DockerClientConfiguration(dockerEngineUrl).CreateClient();
const string imageName = "rabbitmq:3.11-management";
await PullImage(client, imageName);
async Task PullImage(IDockerClient client, string imageName)
{
var imageAlreadyExists = await ImageAlreadyExists(client, imageName);
if (!imageAlreadyExists)
{
Console.WriteLine($"Image named '{imageName}' not found. Pulling image. {DateTime.Now.ToLongTimeString()}");
var imagesCreateParameters = new ImagesCreateParameters
{
FromImage = imageName
};
var progress = new Progress<JSONMessage>();
progress.ProgressChanged += (sender, e) =>
{
Console.WriteLine($"From: {e.From}");
Console.WriteLine($"Status: {e.Status}");
Console.WriteLine($"Stream: {e.Stream}");
Console.WriteLine($"ID: {e.ID}");
Console.WriteLine($"Progress: {e.ProgressMessage}");
Console.WriteLine($"Error: {e.ErrorMessage}");
};
await client.Images.CreateImageAsync(imagesCreateParameters, new AuthConfig(), progress);
Console.WriteLine($"Image named '{imageName}' pulled. {DateTime.Now.ToLongTimeString()}");
}
}
async Task<bool> ImageAlreadyExists(IDockerClient client, string imageName)
{
var listImagesParameters = new ImagesListParameters { All = true };
var images = await client.Images.ListImagesAsync(listImagesParameters);
return images.Any(image => image.RepoTags.Contains(imageName));
}
What actually happened?:
I've got the following exception:
Unhandled exception. Newtonsoft.Json.JsonReaderException: Error parsing undefined value. Path '', line 1, position 2.
at Newtonsoft.Json.JsonTextReader.MatchAndSetAsync(String value, JsonToken newToken, Object tokenValue, CancellationToken cancellationToken)
at Newtonsoft.Json.JsonTextReader.ParseValueAsync(CancellationToken cancellationToken)
at Docker.DotNet.Models.StreamUtil.MonitorStreamForMessagesAsync[T](Task1 streamTask, DockerClient client, CancellationToken cancellationToken, IProgress1 progress)
at Docker.DotNet.Models.StreamUtil.MonitorResponseForMessagesAsync[T](Task1 responseTask, DockerClient client, CancellationToken cancel, IProgress1 progress)
at Program.<
$>g__PullImage|0_9(IDockerClient client, String imageName) in /source/Program.cs:line 303
at Program.<$>g__CreateQueue|0_0(IDockerClient client, ICollection`1 fileNames) in /source/Program.cs:line 46
at Program.$(String[] args) in /source/Program.cs:line 26
at Program.(String[] args)
What did you expect to happen?:
RabbitMq image pulled and visible in docker image list
Additional information:
The text was updated successfully, but these errors were encountered:
Output of
dotnet --info
:What version of Docker.DotNet?:
Steps to reproduce the issue:
Just run below code as a ConsoleApp (ofc. you need docker deamon running):
What actually happened?:
I've got the following exception:
What did you expect to happen?:
RabbitMq image pulled and visible in
docker image list
Additional information:
The text was updated successfully, but these errors were encountered: