Wordpress Docker container redirects my request from port 8000 to 80

For a minute stop your nginx, run this container with docker run -p 80:80 [...]. Then your browser will be able to access http://localhost/wp-admin/; there should be a property called something like "Site URL". Change it to http://localhost:8000/ and save.

This will cause Wordpress to redirect (it will use HTTP 301) any visitor to http://localhost:8000/ whether or not the Apache is listening on that port.

Then docker commit your customization, and run the committed image with docker run -p 8000:80 [...]


Edit the wp-config.php configuration file

It is possible to set the URL site manually in the wp-config.php configuration file.

Add these two lines to your wp-config.php, where "example.com" is the domain for your site.

define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );