dotnet / Docker.DotNet

:whale: .NET (C#) Client Library for Docker API
https://www.nuget.org/packages/Docker.DotNet/
MIT License
2.23k stars 381 forks source link

Connecting to the host of the current container #592

Closed OliwerXi closed 1 year ago

OliwerXi commented 1 year ago

What version of Docker.DotNet?:

3.125.12

Additional information: So I've been looking around the README on here without any success in finding what I am looking for, so I decided to open this issue. What is on my mind is; I am running the main application inside of a Docker container and the application is going to be making use of this client lib - is there a way to connect to the host with Docker.DotNet from the main app that is inside an already constructed container?

HofmeisterAn commented 1 year ago

Yes, that works fine. It is not limited by Docker.DotNet. You just have to provide access to the Docker daemon. There are different ways to accomplish it. I described two of them here: https://github.com/testcontainers/testcontainers-dotnet/issues/492#issuecomment-1171283803 or just search for something like Docker in Docker.

OliwerXi commented 1 year ago

I guess I used the wrong choice of words when re-searching this. Once I worded it access docker daemon inside container, there was many more results and found out I can mount the socket initially. Cheers, @HofmeisterAn.