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
> Unfortunately, there has been no further development or bug fixes in [Docker.DotNet](https://github.com/dotnet/Docker.DotNet/tree/aacf3c26131f582ca8acc34084663a4b79e28d38) for some time now, and the repository appears inactive. Reaching the current maintainer is challenging. I understand that priorities shift, and maintaining an open-source project is time-consuming and exhausting. As maintainers, we often cannot dedicate the necessary time. Over the past months—and even years—I have frequently offered my help.
5
3
>
6
4
> Docker.DotNet is an important upstream dependency for Testcontainers for .NET and many other developers. It would be unfortunate for this valuable work not to continue. Therefore, I have decided to fork the repository to focus on essential fixes, improvements, and updates for the Docker Engine API. I am also accepting further contributions and remaining PRs from the upstream repository.
7
5
8
6
# .NET Client for Docker Remote API
9
7
10
-
This library allows you to interact with [Docker Remote API][docker-remote-api]endpoints in your .NET applications.
8
+
This library allows you to interact with [Docker Remote API][docker-remote-api] endpoints in your .NET applications.
11
9
12
10
It is fully asynchronous, designed to be non-blocking and object-oriented way to interact with your Docker daemon programmatically.
13
11
14
-
## Versioning
15
-
16
-
Version of this package uses [SemVer](https://semver.org/) format: `MAJOR.MINOR.PATCH`. `MINOR` segment indicates
17
-
the [Docker Remote API][docker-remote-api] version support. For instance `v2.124.0` of this library supports
18
-
[Docker Remote API][docker-remote-api]`v1.24`. This does not guarantee backwards compatibility as [Docker Remote API][docker-remote-api] does not guarantee that either.
19
-
20
-
`MAJOR` is reserved for major breaking changes we make to the library itself such as how
21
-
the calls are made or how authentication is made. `PATCH` is just for incremental bug fixes
@@ -53,14 +44,15 @@ You can initialize the client like the following:
53
44
usingDocker.DotNet;
54
45
DockerClientclient=newDockerClientConfiguration(
55
46
newUri("http://ubuntu-docker.cloudapp.net:4243"))
56
-
.CreateClient();
47
+
.CreateClient();
57
48
```
58
-
or to connect to your local [Docker for Windows](https://docs.docker.com/docker-for-windows/) daemon using named pipes or your local [Docker for Mac](https://docs.docker.com/docker-for-mac/) daemon using Unix sockets:
49
+
50
+
or to connect to your local [Docker Desktop on Windows](https://docs.docker.com/desktop/setup/install/windows-install/) daemon using named pipes or your local [Docker Desktop on Mac](https://docs.docker.com/desktop/setup/install/mac-install/) daemon using Unix sockets:
59
51
60
52
```csharp
61
53
usingDocker.DotNet;
62
54
DockerClientclient=newDockerClientConfiguration()
63
-
.CreateClient();
55
+
.CreateClient();
64
56
```
65
57
66
58
For a custom endpoint, you can also pass a named pipe or a Unix socket to the `DockerClientConfiguration` constructor. For example:
@@ -70,27 +62,29 @@ For a custom endpoint, you can also pass a named pipe or a Unix socket to the `D
You can cancel streaming using the CancellationToken. On the other hand, if you wish to continuously stream, you can simply pass`CancellationToken.None`.
171
+
You can cancel streaming using the cancellation token. Or, if you wish to continuously stream, you can simply use`CancellationToken.None`.
178
172
179
-
#### Example: HTTPS Authentication to Docker
173
+
#### Example: HTTPS authentication to Docker
180
174
181
-
If you are [running Docker with TLS (HTTPS)][docker-tls], you can authenticate to the Docker instance using the [**`Docker.DotNet.X509`**][Docker.DotNet.X509] package. You can get this package from NuGet or by running the following command in the “Package Manager Console”:
175
+
If you are [running Docker with TLS (HTTPS)][docker-tls], you can authenticate to the Docker instance using the [**`Docker.DotNet.Enhanced.X509`**][Docker.DotNet.X509] package. You can get this package from NuGet or by running the following command in the "Package Manager Console":
182
176
183
-
PM> Install-Package Docker.DotNet.X509
177
+
PM> Install-Package Docker.DotNet.Enhanced.X509
184
178
185
-
Once you add `Docker.DotNet.X509` to your project, use `CertificateCredentials` type:
179
+
Once you add `Docker.DotNet.Enhanced.X509` to your project, use the`CertificateCredentials` type:
If you don't want to authenticate you can omit the `credentials` parameter, which defaults to an `AnonymousCredentials` instance.
194
188
195
-
The `CertFile` in the example above should be a .pfx file (PKCS12 format), if you have .pem formatted certificates which Docker normally uses you can either convert it programmatically or use `openssl` tool to generate a .pfx:
189
+
The `CertFile` in the example above should be a PFX file (PKCS12 format), if you have PEM formatted certificates which Docker normally uses you can either convert it programmatically or use `openssl` tool to generate a PFX:
(Here, your private key is key.pem, public key is cert.pem and output file is named key.pfx.) This will prompt a password for PFX file and then you can use this PFX file on Windows. If the certificate is self-signed, your application may reject the server certificate, in this case you might want to disable server certificate validation:
(Here, your private key is `key.pem`, public key is `cert.pem` and output file is named `key.pfx`.) This will prompt a password for PFX file and then you can use this PFX file on Windows. If the certificate is self-signed, your application may reject the server certificate, in this case you might want to disable server certificate validation:
If the Docker instance is secured with Basic HTTP Authentication, you can use the [**`Docker.DotNet.BasicAuth`**][Docker.DotNet.BasicAuth] package. Get this package from NuGet or by running the following command in the “Package Manager Console”:
202
+
If the Docker instance is secured with "Basic" HTTP authentication, you can use the [**`Docker.DotNet.Enhanced.BasicAuth`**][Docker.DotNet.BasicAuth] package. Get this package from NuGet or by running the following command in the "Package Manager Console":
By default this client does not specify version number to the API for the requests it makes. However, if you would like to make use of versioning feature of Docker Remote API You can initialize the client like the following.
218
+
By default this client does not specify version number to the API for the requests it makes.
219
+
However, if you would like to make use of versioning feature of Docker Remote API You can initialize the client like the following.
Here are typical exceptions thrown from the client library:
242
229
243
-
***`DockerApiException`** is thrown when Docker API responds with a non-success result. Subclasses:
230
+
***`DockerApiException`** is thrown when Docker Engine API responds with a non-success result. Subclasses:
244
231
***``DockerContainerNotFoundException``**
245
232
***``DockerImageNotFoundException``**
246
233
***`TaskCanceledException`** is thrown from `System.Net.Http.HttpClient` library by design. It is not a friendly exception, but it indicates your request has timed out. (default request timeout is 100 seconds.)
@@ -252,12 +239,13 @@ Here are typical exceptions thrown from the client library:
252
239
253
240
Docker.DotNet is licensed under the [MIT](LICENSE) license.
0 commit comments