-1

Here it is my Dockerfile

Dockerfile:

FROM openjdk:8

ADD target/demo.jar demo.jar

EXPOSE 8080

ENTRYPOINT ["java","-jar","demo.jar"]

It is running inside the docker container. when i run curl -v http://192.168.99.100:8080 in the docker window, It shows the result. But when I run in browser , It is not working. I have tried both http://192.168.99.100:8080 and http://localhost:8080. How to connect my docker ip from browser?

tgogos
  • 23,218
  • 20
  • 96
  • 128

1 Answers1

0

1.Open Oracle VM VirtualBox Manager

2.Select the VM used by Docker

3.Click Settings -> Network

4.Adapter 1 should (default?) be "Attached to: NAT"

5.Click Advanced -> Port Forwarding

6.Add rule: Protocol TCP, Host Port 8080, Guest Port 8080 (leave Host IP and Guest IP empty)

Guest is your docker container and Host is your machine You should now be able to browse to your container via localhost:8080 and your-internal-ip:8080.

Reference:-->Yes I have found the answer in this link https://stackoverflow.com/a/36458215/8295908. Thanks guys.