Skip to content
Advertisement

How to access a port exposed from a docker container?

JavaScript
JavaScript

Above outputs show that the port 5000 has been exposed (I hope).

JavaScript

Now when I do from the host machine:

JavaScript

What is the way to access that port since it is exposed and the container is running?

JavaScript

Advertisement

Answer

First of all, check if you have an application, listening to the port inside your container. Just try to connect to it from your container:

JavaScript

If it’ll work then you have a problem with port exposing, otherwise, there is no web server running inside your container.

And the error you get

JavaScript

seems to point to the problem in your web server rather then connectivity issues.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement