mysql – wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation


I searched the whole net and stackexchange for a reason and a solution, but couldn’t find any. There are many questions (and answers) related to own plugins and the code how to create tables on activation. But this applies not here, because I have this problem with well known and maintained plugins from the wordpress plugin repository.

So, the situation:
A kvm guest with around 20 docker stacks. Each stack consists of a nginx, a php:8-fpm and a mariadb container. In the nginx container is a web directory as a shared volume, that contains a wordpress installation. (So I’m not using the wordpress docker image!).

The wordpress’es are running like a charm. I can access the backend and the frontends, I can install plugins and themes… everything is working… until…

Until it comes to a plugin installation that wants to create own sql tables on activation.

The tables are not created, I only receive an error that says, the table xxx is not existent and the plugin can not be activated.

This happens on all plugins from the wordpress plugin repository, when they want to create own tables on activation.

Everything else is working like a charm.

The sql user is allowed to create tables… this was checked through the mysql console.
The wp-config.php is correct… everything has worked when not in a docker container. This happens only when inside a docker container.

So here’s my docker-compose.yml

version: '3.8'
    image: nginx:latest
    restart: always
      - ./web:/usr/share/nginx/html
      - ./default.conf:/etc/nginx/conf.d/default.conf
      - ./logs:/var/www/logs
    image: php:8-fpm
    restart: always
        - ./web:/usr/share/nginx/html
        - ./errors.ini:/usr/local/etc/php/conf.d/errors.ini:rw
        - ./logs:/var/www/logs
      driver: syslog
        tag: docker/php-fpm
    image: mariadb:latest
    restart: always
      MYSQL_ROOT_PASSWORD: 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
      MYSQL_DATABASE: 'database'
      MYSQL_USER: 'dbuser'
      MYSQL_PASSWORD: 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
      - "3306"
      - ./mysql:/var/lib/mysql

Here comes the default.conf:

server {
    server_name _;
    index index.php index.html;

    client_max_body_size 1024M;
    client_body_timeout 900s;
    fastcgi_buffers 16 16k; 
    fastcgi_buffer_size 32k;
    send_timeout 3600;
    keepalive_timeout 60m;
    fastcgi_send_timeout 3600s;
    fastcgi_read_timeout 3600s;
    error_log  /var/www/logs/nginx-error.log;
    access_log /var/www/logs/nginx-access.log;
    root /usr/share/nginx/html;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param HTTPS on;
        fastcgi_pass php-fpm:9000;


Christin Löhner 2 years 2021-12-14T08:04:28-05:00 0 Answers 0 views 0

Leave an answer