How to connect to docker container from localhost How to connect to docker container from localhost docker docker

How to connect to docker container from localhost


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:

docker run -p 4444:4444 ...

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


You have to bind the 4444 port to a port of your host. You can do this in the run command with a -p [hostport]:[containerport]

Exemple : docker run -p 8081:80 php:5.6-apache


Had the same problem. Add --host "string" to my docker - compose.

command: uvicorn main:app --reload --port 8000 --host 0.0.0.0

You could read more about connection between your host and docker containers here.