osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: host not found when using http4 in docker container


OK, I think I worked out how to resolve this.
It seems you need to have a `depends_on` property in the container that is posting the HTTP request. The service that is receiving the request need to be present in the `depends_on` otherwise Java cannot resolve the host names (even though the operating system can). e.g. in my case I needed to specify something like this:

    depends_on:
        coreservices:
            condition: service_healthy

Clearly a Docker and Java thing, not really anything to do with Camel or the HTTP4 component.
But very strange nonetheless!


On 06/06/18 04:35, Willem Jiang wrote:
Can  you add a link  to the camel container just like this ?

camel:
image: "camel:0.3.0-SNAPSHOT"
hostname: camel
links:
- "otherHost"
- "zipkin:zipkin.io"


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Jun 6, 2018 at 4:40 AM, Tim Dudgeon <tdudgeon.ml@xxxxxxxxx> wrote:

On 05/06/18 20:40, Robin Vanderhallen wrote:

Are both containers in the same network in the docker compose file?

Yes. Both are in the same network environment, but this is not the default
network.

         networks:
         - xxx

Tim