Skip to content
Advertisement

How to connect to docker container from localhost

I created a docker container which is running 2 java processes – one of the processes is listening on port 4444 and should have access from browser hitting the following URL:

http://{host}:4444/grid/console

How do I hit this URL from my browser on the host – connect to the container on port 4444?

This is the response from docker inspect:

JavaScript

Advertisement

Answer

As you can see from the output in your question, your container’s ip address is 172.17.0.2. Just point your browser at http://172.17.0.2:4444.

Alternately, you could forward this to a host port, as in:

JavaScript

And then on your host run you could access localhost:4444.

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