Hello, 127.0.0.1 from within the app-container is NOT the docker-host’s 127.0.0.1.
As your redis- and mongo-services do not provide ports to the docker-host (to the outside world) even the docker-host’s ip-address or the docker-networks-default-ip-address 172.17.0.1 (or on windows the hostname host.docker.internal) will not work.
But you should be able to use the service-name mongo and redis or the container’s-names chatapp_mongo and chatapp_redis to connect to from the app-container.
by default redis port 6379 is not exposed outside world if you are trying to access Redis that way. Redis is available within the container as its starting redis-server on startup. below is one example where internally its using redis and exposes app service.
You are absolutely right, however, the error message was thrown by the app container and the containers were not using the host network or a common network namespace (network_mode: service:app) so as @matthiasradde answered, other containers should have referred to the redis container by the service name or container name in the same compose project.