run batch in wordpress docker container

I am trying to run batch in wordpress official container.
In container I want to run very simple batch like below:

./wordpress_batch.php

  • Error while configuring UCP replica
  • A completely closed source docker container
  • How to config my nginx to a running container with rails using raspian?
  • Sync folder in docker image from Jhipster
  • Understanding a complex docker command
  • Syslog from nginx Docker container to logstash
  • define('BASEPATH', '/path/to/wordpress');
    require_once(BASEPATH . '/wp-load.php');
    
    # batch program start
    echo "batch test";
    var_dump($wpdb);
    

    But no output is shown.
    This code work in wordpress in host machine.
    What is wrong in docker container?
    Any ideas to run this code?

    Thanks.

    ./docker-compose.yml:

    version: "2"
    services:
        wordpress:
            build: containers/wordpress
            ports:
                - "9000:80"
            depends_on:
                - db
            environment:
                WORDPRESS_DB_HOST: "db:3306"
            env_file: .env
            volumes:
                - ./wordpress_batch:/var/batch/
        db:
            build: containers/db
            env_file: .env
            volumes:
                - db-data:/var/lib/mysql
    volumes:
        db-data:
            driver: local
    

    ./containers/db/Dockerfile:

    FROM mysql:latest
    

    ./containers/wordpress/Dockerfile:

    FROM wordpress:latest
    

    The way I ran the code:

    $ docker-compose run wordpress bash
    # root@97658bd14387:/var/batch# php wordpress_batch.php
    

  • Dockerfile COPY / ADD fails for file in build context
  • Docker Pull taking unexpectedly long time via Ansible
  • Remote Docker daemon with public access from any client?
  • Is it possible to let ansible print each statement?
  • Cannot access HTTPS service from Docker container via Virtual Box
  • Storing in an ENV the outcome of a git command
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.