0

I am trying to setup a Wordpress container using docker, solely on my internal LAN. When I launch the docker container with a port mapping of "8080:80" (which is what is recommended on the official Wordpress docker hub page), and go to my Firefox browser and type in the server's IP address and port (i.e. http://192.168.1.190:8080), I expect to see the Wordpress page but instead firefox instantaneously overwrites the address as "http://192.168.1.190:8000" and then gives me an "unable to connect, Firefox can’t establish a connection to the server at 192.168.1.190:8000" message.

If I launch the docker container with a port mapping of "8000:80", everything works fine.

On further testing, it seems if I map the container to anything other than 8000:80, I get the redirect "unable to connect" problem.

Can you guys help me understand what exactly is happening? Does this have something to do with the Wordpress docker container?, or Firefox?, or something else entirely? I don't recall having any problems mapping other containers to whatever port I want and then navigating to them on my home LAN using firefox...

xixor
  • 13
  • 1
  • it is the configuration of the application running inside the container, that is using port 8000 in its base-url – ppuschmann May 19 '21 at 21:18

1 Answers1

1

This happens because the WordPress root URL is ocnfigured to be http://192.168.1.190:8000 inside the container. If WordPress receives a request to some other URL, it sends back a redirect to the correct address.

You need to look into WP_SITEURL / WP_HOME defines in wp-config.php, or corresponding settings in WordPress admin interface.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Thanks! Yes this is really helpful info. I am just curious though, why would the official wordpress docker image (or at least the one I pulled "wordpress:latest") be configured by default in this manner (i.e. expecting port 8000), yet the docs at https://hub.docker.com/_/wordpress contemplate it being setup on port 8080? – xixor May 19 '21 at 20:10
  • That is some kind of bug, you should report that to WordPress people. – Tero Kilkanen May 20 '21 at 05:59