naresh goty
naresh goty

Reputation: 155

Spring boot app with ignite cache in docker container

Problem summary: Cannot access spring boot web app running in container with host networking.

I'm running two containers in my machine.

-> container 1: Apache ignite is running as spring boot (with no webserver enabled) app, and enabled static IP address range (47100-47109) in server mode. -> container 2: Sample Spring boot web app with apache ignite as embedded client mode (with same static IP address range), trying to connect to another ignite node in container 1.

Since apache ignite nodes can discover by static IP address, i set the option host networking mode (--net=host) when starting containers (1&2).

Everything is good so far: I can start both containers and cache nodes in both containers formed cluster as expected. Now the problem is: when i try to access spring boot web app in container 2, i cannot access the app in default port 8080. This spring boot web app can be accessible if run as standalone app, but with container in host networking, i cannot access the port 8080. Can any one shed some lights in this issue?

Appreciate much! Naresh

Upvotes: 1

Views: 519

Answers (1)

Bruno Barin
Bruno Barin

Reputation: 193

I presume you are using Docker to run your containers. In order to expose the ports to your host, you should run your docker container with the -p parameter. Something like docker run -p <hostport>:<containerport> image

Upvotes: 1

Related Questions