"Docker Compose in Docker Compose" - Networking Issue


I currently have docker-compose setup in which I have a couple of services (a database and a node-js server) along with a “test” service. There is a “prod” network and a “test” network, and the test service is the only thing connected to the test network. The test service has the docker socket bind mounted and uses docker compose (within itself) to create sibling services (the database and node-js server) and add them to the external test network. Thus the test service should be able to communicate with both the database and the server, once it brings them up. It is able to communicate with the database, but cannot talk to the node-js server (the node-js server can also talk to the database). I have used “docker network inspect” in order to verify that they are all connected to the same network. When I run “wget” when in the test container, it is able to resolve the host name for the node-js server, but returns “connection refused” rather than the 404 response that I am expecting (and get when running the command outside of the test container).

Any ideas why I wouldn’t be able to talk to one services in particular when they’re all connected to the same network?

Thanks in advance