ERROR: for ... Cannot start service ...: driver failed programming external connectivity on endpoint ...: Error starting userland proxy: listen tcp 0.0.0.0:51030: bind: address already in use

This is just a hint for all that are coming later with the same problem. Maybe there is a better place to put.

Situation: We had the problem that containers did not start by random. We needed to restart them for several times until they were up again.

The problem was simply that we exposed ports in the range of 50000 - 51000. These are obviously often used as source ports for outgoing connections. And so, as soon as a process opens a connection to somewhere and the os assigns one of the matching 5**** ports to this connection the container doesn’t start anymore.

How we ended up at this perception:
At the beginning we were thinking that there were applications listening on the host system like it is often the case - It wasn’t. We checked the connections with

netstat -tulpen

Well, that was the snag: With the “-l” parameter netstat doesn’t show the outgoing connections.

I hope this helps other people.