docker-compose restart connection pool full

后端 未结 4 2738
我寻月下人不归
我寻月下人不归 2021-02-20 02:28

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

相关标签:
4条回答
  • 2021-02-20 03:04

    You can try reset network pool before deploy

    $ docker network prune
    

    Docks here: https://docs.docker.com/engine/reference/commandline/network_prune/

    0 讨论(0)
  • 2021-02-20 03:07

    I got the same issue with my Django Application. Running about 70 containers in docker-compose. This post heled me since it seems that prune is needed after setting COMPOSE_PARALLEL_LIMIT

    I did:

    docker-compose down
    export COMPOSE_PARALLEL_LIMIT=1000
    docker network prune
    docker-compose up -d
    
    0 讨论(0)
  • 2021-02-20 03:11

    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
    • there doesn't appear to be any way to inject a bigger pool size from the docker-compose or docker libraries

    I 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.

    0 讨论(0)
  • 2021-02-20 03:16

    For future readers. A small addition to the answer by @andriy-baran You need to stop all containers, delete them and them run network prune (because the prune command removes unused networks only)

    So something like this:

    docker kill $(docker ps -q)
    docker rm $(docker ps -a -q)
    docker network prune
    
    0 讨论(0)
提交回复
热议问题