Connections close on container but not on host

I am running a container hosting a Jenkins. Originally the container seemed to lose network connection making the Jenkins to fail. I found some posts dealing about exceeding maximum open connections which was originally set to 900:
> cd ~/Library/Containers/com.docker.docker/Data/database/
> git reset --hard
> echo 2000 > com.docker.driver.amd64-linux/slirp/max-connections
> git add com.docker.driver.amd64-linux/slirp/max-connections
> git commit -s -m 'increase max connections to 2000`

solved my issue, but now I am afraid only temporarily:
Doing a netstat on the container console didn’t show any shocking results, a normal amount of open connections.
Doing a netstat on the host however, learned me that about 1800 connections were open in the CLOSE_WAIT state. I also notice that this number is rising.
From the mac os kernel variables (sysctl -a) I found a variable “net.cfil.close_wait_timeout: 1000” so I should expect that the connections in CLOSE_WAIT should close after 1000 ms, but still the number is rising, also, the amount being higher than 1800 seems odd?
On Linux machines, this problem seems not to occur with the same container (and same setup).

So now I wonder, is there a way that I can make these connections automatically close?
If not, what would be the script on Mac to close the CLOSE_WAIT connections safely?

I’m seeing this issue too. I even removed this max-conn limit as suggested in , but I’m still hitting the 900 forwarded connections on docker 4 mac 17.03.1-ce-mac5 (16048)

Did you find out what’s going on or how to solve the issue?

BTW - I believe the net.cfil.close_wait_timeout is measured in seconds, not in ms as you suggest

The only solution I could think of was to kill the daemons process which causes a restart of the daemon.
Putting that in a crontab -e causes a docker reset on a specific time daily.