Sockets not being released
I'm seeing an odd issue where it appears the unix sockets are not getting released. A very simple version of my app is basically just a while(true) loop that instantiates the DockerClient, executes ListContainersAsync, and for each container perform InspectContainerAsync. Even after disposing of DockerClient the number of open files (including sockets) continues to creep up and eventually causes me to get an IOException with the message Too many open files
Output of dotnet --info:
.NET Command Line Tools (1.0.3)
Product Information:
Version: 1.0.3
Commit SHA-1 hash: 37224c9917
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.3
What version of Docker.DotNet?:
2.124.3
Steps to reproduce the issue:
- Run https://github.com/devlife/TooManySockets/
- Run
apt-get update - Run
apt-get install lsof -y - Run
lsof | wc -l

What actually happened?: If you run that several times over 10 or 15 minutes you'll see the line count increase drastically and almost never decrease. Eventually this causes
Connection failed ---> System.Net.Sockets.SocketException: Too many open files in system
at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
at Docker.DotNet.DockerClient.<>c__DisplayClass28_0.<<-ctor>b__1>d.MoveNext()
What did you expect to happen?: I'd expect the socket connections to drop.
Additional information:
If you run lsof -F t | cut -c 2- | awk '{$1=$1;print}' | sort | uniq -c | sort -n you'll see it's unix that is the owner of the open files/sockets.

One potentially important piece of information that I left out is that the app running in the container is intended to make a remote api call to it's host to retrieve information about the other containers running on the same host.
I'm running Windows 10, VS 2017, and docker tools (which can be found in the repo). I have not been able to reproduce this locally for all that I've tried. My coworker is running a mac and VS Code and can also not repro. The only place that I can always reproduce this is on a linux docker host. In my particular case we're running in Amazon ECS.
Please let me know if I can provide any additional information.
Anything on this?
@devlife Sorry, we haven't had the time to investigate as we are heads down in a development cycle right now. One question that might help your effort to reproduce locally: have you tried reproducing in a VM locally? I assume your ECS Linux docker host is a VM. Hopefully we'll have time to circle back on this and the other open issues soon.
No worries @swernli just wanted to make sure it wasn't lost in the interwebs. I'll put some additional effort to repro'ing locally. My linux docker host is in AWS so it would definitely be a VM.
@devlife - I think this was fixed as part of #233. Could you verify for me?
@jterry75 that definitely looks to have fixed it!