简体   繁体   中英

When using Docker Desktop for Windows, how do you find the URL of the Docker daemon?

This is similar to this question , but I am asking this about Windows, whereas the answers there pertain more to Linux/Unix.

I am developing ASP.NET Core Microservices on Windows 10, using Docker Desktop. I want to write .NET Core tests that can interact directly with the Docker daemon. This basically involves one of two things:

  1. interacting with Windows's shell inside the tests, or
  2. using APIs to interact with Docker directly, which involves getting the URL.

The problem is that I don't see anywhere that the URL is listed or can be found. Where can this be located?


In this particular situation, I probably wouldn't mind using Docker.DotNet , which itself seems to wrap around some sort of REST API for Docker. However Docker.DotNet's documentation has an error on the front page, saying that DockerClientConfiguration can be instantiated without passing in any arguments, in order to interact with the local Docker daemon. When trying that though, a compilation error is produced, and Intellisense shows that the endpoint parameter is always required. If I try to call some sort of REST API directly, I'm still going to need a URL to point to.

Even docker info doesn't seem to give a clear answer, though it does provide a URL for Insecure Registries . Docker Desktop doesn't describe anything. Information online is either non-applicable for Windows or otherwise irrelevant.


EDIT:

In response to a quick answer, there is the following setting on Docker Desktop, which is unchecked by default:

Expose daemon on tcp://localhost:2375 without TLS

If this is always the URL, regardless of whether that box is checked or not, then that is the answer. If so, please specify. I did see this before, but because it was sitting next to a checkbox, I didn't feel it could be relied upon, particularly while using with a new API that I'm trying to learn at the same time.

When using Postman to try to call the List Containers endpoint from Docker's REST API directly, that URL doesn't appear to be working, either through TCP or HTTP. Same situation with the addresses listed under Resources>Network.

The URL to the daemon is clearly outlined in the settings. https://docs.docker.com/docker-for-windows/images/settings-general.png

run docker context list command to see list of endpoints

docker context ls

enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM