Issues with Docker IP Addresses

We’ve been seeing docker issues when running tests in circleCI for a while, but they’re intermittent. They’re still enough to be a problem though. The most common errors seem to be around IP addresses, including this:

Bind for 0.0.0.0:XXXXX failed: port is already allocated

And

Creating network “[network-name]” with the default driver
could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

And

Creating network “[network name]” with the default driver
Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running?

All errors are random and intermittent, but happening enough to create serious flakiness. Anyone have any thoughts on what’s causing this?

Hello @NoahFT,

Sounds like you need access to a privileged Docker Container. Are you running within the Docker executor? If so, try switching over to using Docker within a Linux VM.
https://circleci.com/docs/2.0/executor-types/#using-machine