nithin
nithin

Reputation: 401

docker image running not able to access api in spring boot gradle

I have created a image of spring boot gradle project by using command gradlew jibDockerBuild

I run the image by this command docker run -p 8082:8082 demo:0.0.1-SNAPSHOT.Image is running successfully on port 8082.In project application.properties server.port is 8082 only.

I am not able accesss api so I have checked in my machine whether this process is running on the port or not by command netstat -a -n -o | find "8082".No process is running on that port.

Upvotes: 0

Views: 69

Answers (1)

MyTwoCents
MyTwoCents

Reputation: 7624

When you install Docker on Windows by Docker Toolbox by default Docker will run on 192.168.99.100 IP (DOCKER_IP).

You can access all your containers running inside docker with DOCKER_IP on your Host machine ie Windows.

Read more on it here

Regarding your mapping query

You have mapped port, which means your container port will be mapped to DOCKER_IP:PORT

If you were using Docker on Linux or Mac it will get mapped to localhost:port as in those cases Docker is running on localhost.

The same is not true for Windows at least with Docker Toolbox.

As per your configuration, you can access your application on HOST machine by hitting

http://192.168.99.100:8082 

Upvotes: 2

Related Questions