Docker Community Forums

Share and learn in the Docker community.

POST from container to host


(Enric1994) #1

I have a python instance listening in the port 5000 of my host. I would like to send a POST from inside my container.

My current docker only expose the port 3000:3000, and if I expose the port 5000 i get the typical error “port already in use”.

The command I am trying is curl http://localhost:5000
output: curl: (7) Failed to connect to localhost port 5000: Connection refused

How can I perform a curl correctly from my container to my host:5000 ?

Thanks!