My team and I are converting some of our infrastructure to docker using docker-compose. Everything appears to be working great the only issue I have is doing a restart it gives
I have been struggling with this error message as well with my development environment that uses more than ten containers executed through docker-compose
.
WARNING: Connection pool is full, discarding connection: localhost
I think I've discovered the root cause of this issue. The python library requests
maintains a pool of HTTP connections that the docker
library uses to talk to the docker API and, presumably, the containers themselves. It's my hypothesis that only those of us that use docker-compose with more than 10 containers will ever see this. The problem is twofold.
requests
defaults its connection pool size to 10, and docker-compose
or docker
librariesI hacked together a solution. My libraries for requests
were located in ~/.local/lib/python2.7/site-packages
. I found requests/adapters.py
and changed DEFAULT_POOLSIZE
from 10 to 1000.
This is not a production solution, is pretty obscure, and will not survive a package upgrade.