Docker Community Forums

Share and learn in the Docker community.

How do I run the official Drupal image?

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.

That is not an Apache HTTPD image but PHP FPM. You will not be able to connect this way. FPM listens on a different port and waits for requests from an NginX or HTTPD szerver (or other alternatives). Try another image tag with “apache” in it. Otherwise you have to configure a webserver in front of the PHP FPM container.

See the description on Docker Hub: Docker Hub

This variant contains PHP-FPM, which is a FastCGI implementation for PHP. See the PHP-FPM website for more information about PHP-FPM.
In order to use this image variant, some kind of reverse proxy (such as NGINX, Apache, or other tool which speaks the FastCGI protocol) will be required.

1 Like