Issues with rancher, wordpress from the catalog and an external mysql host

So I am trying to setup my Wordpress container that I got from the catalog in rancher with some random available public port (here :9932)

Everything works as expected if I keep it as is. But as soon as I try to connect to my external mysql host nothing works any more and I am redirected to :8080 away from :9932 and I get ERR_CONNECTION_REFUSED

The mysql user is set up correctly and I have managed to launch a Wordpress container locally connecting to the same mysql database.

The logs in Rancher reveal nothing peculiar and suggest that everything is working correctly so I am all out of ideas. I have also tried using the Wordpress image from scratch resulting in the same issues.

Here is the docker-compose.yml: (node: im not linking the db container to the wordpress container)

version: '2'
services:
   wordpress:
     image: wordpress
     environment:
         WORDPRESS_DB_USER: some_user
         WORDPRESS_DB_NAME: some_db_name
         WORDPRESS_DB_PASSWORD: some_db_password
         WORDPRESS_DB_HOST: some_db_host
    ports:
    - 9932:80/tcp
   db:
     image: mariadb
     environment:
         MYSQL_ROOT_PASSWORD: example

Funnily enough, if I use wrong mysql credentials I am not redirected and I get normal errors in the rancher log.

WordPress’s database contains a setting for what it thinks the base URL of the site is supposed to be and redirects you around if it doesn’t match. Sounds like your database has it in there as :8080.

1 Like

Thanks for the pointer, didn’t know that. I’ll check it out on our mysql machine tomorrow and report back.

Great it worked! Thanks for the help.