-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?

3
  • Can you please update your answer with your docker run command, try also looking into your Docker logs, what does the logs state? Commented Nov 9, 2017 at 4:41
  • 2
    I have tried this stackoverflow.com/a/36458215/8295908 . Now It works Fine. Commented Nov 9, 2017 at 4:47
  • Thanks @RavinduFernando Commented Nov 9, 2017 at 4:57

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Please refer the place you got your answer from, Don't just copy paste the answer of some one else without acknowledgment. stackoverflow.com/a/36458215/4334340
Yes. I jus tell the answer. I have replied your comment itself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.