0

So, I have running php web server inside docker container like so php -S 127.0.0.1:8000. How can I open it via browser in my computer?

I was trying docker run -p 4200:8000 <image_id>, but nothing happens. What am I doing wrong?

Exoriri
  • 327
  • 3
  • 21
  • If you set a Docker container to listen on the container-private 127.0.0.1 address, it won't be reachable from outside its container. Does `CMD php -S 0.0.0.0:8000` work better? (Also see [Docker with php built-in server](https://stackoverflow.com/questions/25591413/docker-with-php-built-in-server).) – David Maze May 22 '22 at 00:17
  • @DavidMaze `CMD php -S 0.0.0.0:8000` didn't work, but thanks for an answer. Question that you sent might be helpful. – Exoriri May 24 '22 at 01:21

0 Answers0