0

I run docker on Windows7, make a simple spring-boot app, put it into image and run it in docker container. When i refer to my app localy (http://localhost:8080) I see the response, everything is OK. When I put it into container and run, it also runs in container, logs are ok, but port mapping doesn't works, and i can not receive answer from my local machine. Pls give an advice P.S. Tried as well to refer from outside (not via http://localhost:8080 but via external local IP of my PC: 192.168.1.10:8080) but the result is the same.

dockerfile:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD docker-spring.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]

build: docker build -t springimg .
run: docker run -p8080:8080 springimg
Rodriguez
  • 143
  • 2
  • 9

1 Answers1

0

Docker on Windows 7 uses virtualization to support docker-engine.

The port binding is currently on the virtual machine that runs docker-engine.

The virtual machine is created and managed with docker-machine.

Run:

docker-machine ip

to know the ip address.

matiferrigno
  • 901
  • 7
  • 8
  • Thank U! It works! And how can I map my local ip to docker-machine ip, if I want to refer to app from outside? – Rodriguez Mar 04 '20 at 20:39
  • Through windows firewall, you could create a rule to map the virtual machine port to the hypervisor. – matiferrigno Mar 04 '20 at 20:42
  • Thanks a lot! Killed a day on it! Thank U! – Rodriguez Mar 04 '20 at 20:45
  • you are welcome. Also you can let virtualbox handle this configure the mapping, there are several links which explain "how to". check https://stackoverflow.com/questions/32174560/port-forwarding-in-docker-machine – matiferrigno Mar 04 '20 at 20:46