2

I have created an image out of my simple spring-boot application and set the port to 7000 for the tomcat , when I run the image and try to hit the service in my local I am not getting any response.

here are the contents of the dockerfile

FROM java:8
VOLUME /tmp
ADD  /target/demo-1.0-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

Am I missing something here ( I am new to docker and I just used the file in spring boot sample docker and created the image and stuck here.)

5
  • Please add more information like which what error are you getting, are you using virtual box to run docker? Commented Feb 1, 2018 at 4:50
  • yes , docker with hyper v - errror like "This site can't be Reached" Commented Feb 1, 2018 at 6:44
  • Is this issue resolved? Commented Feb 8, 2018 at 6:34
  • not yet , if it helps you ( docker installed in windows 10 ) Commented Feb 11, 2018 at 4:17
  • My problem got solved by this link stackoverflow.com/questions/40349893/… Commented Feb 16, 2018 at 21:28

3 Answers 3

1

Apart from publishing the port from docker as mentioned by @Van0SS you need to create a port forwarding rule as well. Open virtualbox and Navigate to VM -> Settings -> Network -> Advanced -> Port forwarding Create a new rule:

Name : <Anything - Purpose of port>
Protocol: TCP
HostIP: 127.0.0.1
Host port: 7000
Guest Port: 7000
Sign up to request clarification or add additional context in comments.

Comments

0

Not sure that it is only one problem, but at least you have to publish your port in docker. To do so run the container with flag:

-p 7000:7000

Try access on :7000 port.

3 Comments

Please share which manual did you use and where demo-1.0-SNAPSHOT.jar came from.
Have you created port forwarding rule in VirtualBox?
@Pramod no please tell me if in case i need to do , i watched a youtube tutorial in which i followed all the steps similar to that ( i installed docker ce for windows , and later installed hyper-v when it prompted me )
0

You need to add: EXPOSE: 7000 to your docker file, and keep an eye on the console log info when running the docker image to see on which port your app is being served.

Useful Ref: https://www.youtube.com/watch?v=FlSup_eelYE

Best of luck!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.