Docker setup - Wordpress

Hello,

I got a bit stuck on a very simple configuration for wordpress, where I subsequently have a problem using the feature (PHP wp_remote_post). I’ve also tried a variant with reverse proxy and ssl certificates etc. But nothing helped and I have a problem with this with all configurations.

docker-compose

services:
  database:
    image: mariadb:latest
    container_name: wordpress_database    
    environment:
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_DATABASE: wordpress_db
      MYSQL_USER: wp_user
      MYSQL_PASSWORD: wp_password
    ports:
      - "3306:3306"    
    volumes:
      - db-data:/var/lib/mysql

  wordpress:
    image: wordpress:latest
    container_name: wordpress_app
    ports:
      - "8000:80"    
    environment:
      WORDPRESS_DB_HOST: database:3306
      WORDPRESS_DB_NAME: wordpress_db
      WORDPRESS_DB_USER: wp_user
      WORDPRESS_DB_PASSWORD: wp_password
      WORDPRESS_TABLE_PREFIX: wp_
    volumes:
      - ./backend/wordpress:/var/www/html
    depends_on:
      - database

volumes:
  db-data:

Maybe somone have some idea. I hope is ok to ask like this.

Not sure about the problem you’re having, I don’t think there’s enough info. Please provide the error you get

But regardless:
A. If the database is only accessed by that service and not externally, don’t map the port
B. You should use environment variable interpolation for things like the database credentials

Yes normally i use environment variable this was only for test if i have the same problem with simplest setup. I was map over the port because i have problem with access to the DB with table plus.

The problem is i dont see in logs or in wordpress debug log any problem. But some templates and also builders use (PHP wp_remote_post) for filtering the post for example. And in system information from this template or builders is just say the test results of (PHP wp_remote_post) did not pass correctly and the filtering not work.

So i dont know why. When i use any other local setup with some external software like dev kinsta which is also base on docker it is absolutly ok withnout this problem.

I wish i find some problem in logs or somewhere else but i dont know. I am currently learning docker so I wanted to start with something simpler like just wordpress.

I will keep diggin and i hope i find somethink somewhere more…

Just this information i have now.

I think this is an issue you should ask about in a Wordpress community. If they can help you find out what it could be caused by, we can help you find out how it can be caused by Docker. I haven’t used Wordpress for many years. Ther must be also some kind of debug log level setting which can show more info about why the function fails. For now, you shared a Wordpress+PHP issue on a Docker forum which requires Wordpress users here, but the error could occur without Docker as well, so first you need to find out what it means.