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

  • What happens to entrypoint of Docker parent image when child defines another one?
  • Ansible, running role multiple times with different parameter sets
  • Invalid value “zookeeper” for flag -a: valid streams are STDIN, STDOUT and STDERR
  • Cannot install docker on OS X Version 10.9.5
  • how to define HTTP health check in a consul container for a service on the same host?
  • How to define docker image name from within docker-compose.yml?
  • 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
    

  • RUN command in Dockerfile not persisting from container to container
  • getting JsonMappingException with latest spotify docker-client
  • Uncaught exception 'RedisException' with message 'Connection closed'
  • Which Docker images will run on Kubernetes?
  • Connect to remote MySQL db from docker container
  • Amazon EFS access denied while mounting in docker container
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.