I’ve created a docker container with ubuntu image. In that I’ve created a react app and when I try to run the app I could not see the app is running on localhost but in the terminal of container it says its running on the port. How can we connect a docker container with our localhost.
2
Answers
If You have a docker file just pass the port to docker run with -p
3001:3000
If you have a docker compose set the port with:
Finally navigate to localhost:{Port}
From official documentation :
docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
Then
docker ps
and verify its running and ports are exposed.Also check about your firewall, it may block ports.