Docker-Compose Restart Connection Pool Full

`docker-compose up` times out with UnixHTTPConnectionPool

Restarting docker service:

sudo systemctl restart docker

and setting DOCKER_CLIENT_TIMEOUT and COMPOSE_HTTP_TIMEOUT environment variables:

export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

are two workarounds for now. But the issues are still open in docker compose github:

https://github.com/docker/compose/issues/3927

https://github.com/docker/compose/issues/4486

https://github.com/docker/compose/issues/3834

Poetry install throws Connection pool is full, discarding connection: pypi.org. Connection pool size: 10 error when building Docker image

Using your Dockerfile with my project I added a line before the last one as follows:

RUN poetry config installer.max-workers 10

RUN poetry install --no-interaction --no-ansi -vvv

It worked for me!

Docker-compose not starting all services

It looks like mongodb started too late than mongo-express. Try adding depends_on, but I recommend looking at wait-for-it.sh to check if mongodb is started.

version: '3'
services:
mongodb:
container_name: mongo
image: mongo:4.4.15
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=password

mongo-express:
container_name: mongo-express
image: mongo-express
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password
- ME_CONFIG_MONGODB_SERVER=mongodb
depends_on:
- mongodb

mongodb and mongo-express not connecting with docker-compose

The server env var is not ME_CONFIG_MONGODB_ADMINSERVER but ME_CONFIG_MONGODB_SERVER as per the documentation:
https://hub.docker.com/_/mongo-express

Also you need to add a healthcheck for mongodb and make the mongo-express depend on it because node is exiting with exit code 0 after the first failed connection as it says in the log. If it would exit with non-zero exit code docker would try to restart the container as long as it is not failing. It says in the log that this will be the way in the future, but for now you need the healthcheck.

(node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections
are deprecated. In the future, promise rejections that are not handled
will terminate the Node.js process with a non-zero exit code.

So this compose file works:

version: "3"
services:
mongodb:
image: mongo
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=password
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 10s
mongo-express:
image: mongo-express
# restart: on-failure
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password
- ME_CONFIG_MONGODB_SERVER=mongodb
- ME_CONFIG_MONGODB_PORT=27017
depends_on:
mongodb:
condition: service_healthy


Related Topics



Leave a reply



Submit