So everything seems to be working fine, all containers come up, but server can’t connect the other containers which is weird, because here is the /etc/hosts inside the server container:
So if csmapi_server_1 tries to connect to mongodb://csmapi_mongo_1, it fails, but through testing, if I connect instead to the IP (172.17.0.4), it works.
So why, even though the hosts file is correct, is my container not able to resolve the other containers hostnames? Why does it not seem to be using /etc/hosts?
Try getting an SSH session on the build container, shell into the server container, and try ping csmapi_mongo_1. Does that work? You might have to install ping to get this to work.
The test job fails at make test_integration because the integration tests need to have csmapi_server_1 connect to csmapi_mongo_1 and even though the env.list file is being read properly and mongodb://csmapi_mongo_1 is being used, the integration tests fail with ‘Unable to connect to database at mongodb://csmapi_mongo_1/api-local’. I can connect manually with mongo shell using the same connection information.
I don’t know why dns resolution isn’t using /etc/hosts, but it seems to be something with circle 2.0. If I change
then the integration test connects to mongo but then fails at redis (because the same issue). All containers seems to be on the same network (‘bridge’).
Try pinging the service name instead, mongo. I’m used to service names becoming DNS names, but I think that’s because I tend to use DC 2.0 rather than 3.x. What version are you using? It appears to have been omitted from your YAML file.
so it looks like I made a mistake when running ping and I wasn’t actually in the container. It seems like I can ping both mongo and csmapi_mongo_1 from the server container which tells me there is something wrong with how node is trying to reach the mongo container. let me test some other things and get back