0

I'm running a scala application in docker container: docker build -t myapp:latest .

docker run -d -p 8081:8081 --name myapp app:latest

I can access endpoints through docker exec docker exec -it <container hash> bash

I can then access endpoints through the curl command (on docker terminal) curl --request GET http://localhost:8081

However in my local machine, I can't access the same curl command and expect to be able to.

Tried checking localhost port and deploying it with that in the code. DOcker ps reveals nothing is running in docker container; however I can see the curl commands coming with resposne I expect.

Alia
  • 1
  • Hi, welcome to stackoverflow. Could you provide more info about your context and debugging details? did you build the app using sbt package? sbt native packager? did you write your own dockerfile? what was the result you got when you executed curl from the host machine? is it possible to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)? the question [What is the difference between "expose" and "publish" in Docker](https://stackoverflow.com/questions/22111060/what-is-the-difference-between-expose-and-publish-in-docker) might help you – Gastón Schabas Aug 09 '23 at 14:54
  • 1
    I would first check whether it's binding to 0.0.0.0 vs 127.0.0.1 – Mateusz Kubuszok Aug 09 '23 at 15:45

0 Answers0