Hi there,
I currently have a multi-image job, We have 1 primary container(where all the steps run) named primary and 3 secondary containers named A,B,C.
From the primary container I can reach all the secondary containers i.e A,B,C by name(implying the name can be resolved successfully to the correct IP). The secondary containers can all reach each other by name. But I can not reach the primary container from any secondary container by name.
The question is, how can I reach the primary container from any of the secondary containers?
Layout of my circle yaml configuration.
Anyone who has an idea, or anything I can try It will be greatly appreciated.
@thekatertot noticed you are active in forum, could you perhaps have a solution or anything I can try.
Thanks
1 Like
Hi @afro_enthusiast!
If I understand correctly, this thread might help. Interacting with secondary images
If this doesn’t address your question, I’m happy to dig in more with you!
Thanks for the quick response @thekatertot
I had a look at the thread linked, I do not think that is quite related. If I understand correctly, the author of that post wanted to run docker commands on the secondary container.
In my case, I am trying to just achieve a connection from any of the secondary containers back to the main primary container
To recap,
- My primary container can connect to any of the secondary containers by name.
- The secondary containers can all reach each other by name
The issue is any of the secondary containers can not connect to the main primary container by name i.e the secondary container fails to resolve the primary container’s IP address from its name.
TLDR;
Primary ---------> Secondary Connection works
Primary <-XX----- Secondary Can NOT resolve the primary container’s IP from its name
If any more info is required, will gladly provide.
1 Like
Ah ok! Our Docker executor works a little differently than the standard Docker compose approach. This blog is from a few years ago, but still should have the right info for you.
@thekatertot, thanks for the link but I don’t think this quite fits what I am looking for.
The linked post, focuses on extracting/retrieving information from the secondary container from the primary container’s Point of view. I can get what I need from the secondary container from the primary container’s perspective but the reverse is not possible at the moment.
So just to ensure I understand correctly, from what you are saying, The secondary container can not send/initiate a request to the primary container using primary as the host name. My thinking was if a primary container can resolve a secondary container’s IP by name(eg A from the config layout above) then the secondary container should in theory be able to resolve the IP of primary container by using primary as the hostName
Can you share a bit more about what you’re trying to achieve in communicating from the service containers to the primary container? I was only able to find one other similar request and I don’t believe the answer has changed since then. It’s not possible to communicate from the service container to the primary container. But if you can tell us a bit more about your needs we may be able to advise on a different set up.
For instance, would it be possible for you to wire your containers together with docker-compose
and spin them up in our machine executor? With that setup you would have more freedom and control for your containers to interact with each other and the environment they’re running in.
Curious to know more about your needs here and hopefully we can advise on a solution that works for you.
1 Like
Hi @fernfernfern
We are trying to run BlackBox tests from the primary container to the secondary container (which contains the latest version of our app we want to test). The issue is that we need our BlackBox secondary container to forward network traffic to a test server(which lives in the primary container) for us to inspect, as part of the testing. How does the secondary container forward network traffic/requests to the primary container(as shown by line 2 in the diagram)? Is it possible at all?
Docker compose is a solution that would work but, we’re trying to avoid creating an image for our tests.
Visual message flow
Thanks
Hello,
I don’t believe it’s possible to do that with the docker executor. Someone else may chime in to correct me. But it sounds like at the very least you’ll need to use the machine executor. You may not need to use docker-compose. You could spin up the server with a background command, and also spin up the docker container. You might need to setup a poll step to make sure the server is ready before running the docker container. Then just run the docker image with docker run. The machine executor will net you avoid the networking limitations of the docker executor.
I think this should be possible, all of those containers share a network cgroup.
My recommendation would be to add an ifconfig
command into each container and compare the output to see how it all fits together