Unable to call http requests between containers with docker compose

I am trying to set up a CI testing environment with docker compose for an API. I have two docker files, one for the API to run and the other for my tests. Both run and execute properly but when trying to access the url for the API from the testing container I am unable to do an http request getting undefined as a response. They are connected using a default bridge connection. The API is being port forwarded 80:80 and I am able to grab the data on my localhost and in the bash for the API container. I have tried multiple different versions of what to use for testing the API from the other container:


“Name”: “ci_default”,
“Id”: “1c50f5a4bfe14bfc5dd547d1389aee550e4c17504341bac4fb5608084d7c7289”,
“Scope”: “local”,
“Driver”: “bridge”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: null,
“Config”: [
“Subnet”: “”,
“Gateway”: “”
“Internal”: false,
“Containers”: {
“1e45cf38f92edd3ac97a8aed88c9b653d13d715fea4eeb0d529229b5824e9928”: {
“Name”: “ci_ci_1”,
“EndpointID”: “ca2a826124b47e1cb82d4d6676c74ab175acbd47d896d026379132149f170a4d”,
“MacAddress”: “02:42:ac:12:00:03”,
“IPv4Address”: “”,
“IPv6Address”: “”
“48e67e48c110b03a858ba64610fa386c7c9aea252ae821396a260057dc4b684f”: {
“Name”: “ci_api-internal_1”,
“EndpointID”: “ca4f0e92f46f391c62c1329b2c4fc20c81acc9efc30090b5c66eee7498300b46”,
“MacAddress”: “02:42:ac:12:00:02”,
“IPv4Address”: “”,
“IPv6Address”: “”

I’m pretty sure the default bridge network doesn’t do inter-container DNS resolution; you need a non-default bridge-type network.

It’s probably better practice to COPY your application into the image you build than to bind-mount it as a volume. In the situation you’re describing, it doesn’t even really cost you anything, since presumably your CI environment will docker-compose build the images every time.

I have tried creating a network using a bride connection but I am still getting the same response of undefined when both are running on it. Do you know what the naming convention should be when attempting an http call between containers?

    "Name": "ci_testNet",
"Id": "ff1a6b0b80c379808138b4a4ba973fdf61fda7a8c7a1fa064799a3d6f6fbc3f0",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
    "Driver": "default",
    "Options": null,
    "Config": [
            "Subnet": "",
            "Gateway": ""
"Internal": false,
"Containers": {
    "85e429853cfaa34b7e3ead2903ef145f804828de7206060a99d54b185555e953": {
        "Name": "ci_api-internal_1",
        "EndpointID": "246bf17e5375c95789cac8737fc8788e2964d256a4953babfcb84c06bdad101f",
        "MacAddress": "02:42:ac:14:00:02",
        "IPv4Address": "",
        "IPv6Address": ""
    "aabecfc23c946b75d37aec6758b77d39462ac7c1c686ea7bc7bc8d20f317ba48": {
        "Name": "ci_ci_1",
        "EndpointID": "b335c64751b2a9698231d0a465e1a3f712c901805ce553600f1153bb751c1ee4",
        "MacAddress": "02:42:ac:14:00:03",
        "IPv4Address": "",
        "IPv6Address": ""
"Options": {},
"Labels": {}

Did you ever find a solution to this? I am having the same issue