添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to pull and run an Image with Docker.DotNet and I am desperated, I have no Idea how to do this with this library.

Can anyone help me?

I looked at the tutorial on the https://github.com/microsoft/Docker.DotNet but that is not helpful.

 public class DockerService
        private readonly DockerClient DockerClient;
        public DockerService()
            if (OperatingSystem.IsWindows())
                DockerClient = new DockerClientConfiguration(new Uri("npipe://./pipe/docker_engine")).CreateClient();
            else if (OperatingSystem.IsLinux())
                DockerClient = new DockerClientConfiguration(new Uri("unix:///var/run/docker.sock")).CreateClient();
                throw new Exception("unknown operation system");
        public void StartCompose()
            var progress = new Progress<JSONMessage>();
            var task = PullImage(
                new ImagesCreateParameters()
                    FromImage = "mcr.microsoft.com/dotnet/core/sdk",
                    Tag = "latest"
                },null,
                progress);
             task.Wait();
        private Task PullImage(ImagesCreateParameters imagesCreateParameters, AuthConfig authConfig,
            Progress<JSONMessage> progress)
            return DockerClient.Images.CreateImageAsync(imagesCreateParameters, authConfig, progress);

I expect something to happen when I start task.wait()? But the it runs for several minutes and nothing happens.

Yes you are right. Yesterday I reinstalled docker and after that it works and I don't know why. – Christian Jul 9, 2019 at 5:46

Your image name looks wrong. You have the repository, but not the tag.

Looking at: https://hub.docker.com/_/microsoft-dotnet-core-sdk/

suggests you need: mcr.microsoft.com/dotnet/core/sdk:2.2

But that did not change anything. I add latest but the task is runing and runnig and nothing happens. – Christian Jul 8, 2019 at 9:39

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.