I am somewhat new to Docker. I’m trying to get it set up on my machine, but I can’t seem to connect from the host.
My run command
docker run -p 8080:80 drupal:9.1-php7.4-fpm-alpine3.13
Expected result
Based on the image documentation, I would expect to see some kind of default Drupal page on 8080.
Actual result
$ curl http://localhost:8080
curl: (52) Empty reply from server
In Firefox this renders as, “The connection was reset.”
What I’ve tried
There are other questions that have similar symptoms, but the solutions don’t seem to work for me.
One common suggestion is to curl to a different IP such as 0.0.0.0:8080. I’m a little skeptical because that conflicts with the image-specific instructions above, but tried it and didn’t find evidence there’s anything listening there. Also, when the container isn’t running, I’m not able to connect to that URL at all, which is slightly different from not getting a response, so I think I’m on the right track with http://localhost:8080/
The other common suggestion is to make sure I’m binding a port outside the container, but in my case it’s right there as -p 8080:80.