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

  • Cannot start docker daemon in CentOS7
  • Unable to dockerize a nodeapp
  • Building small container for running compiled go code
  • How to persist MongoDB data between container restarts?
  • Creating kubernetes cluster inside an existing VPC in AWS
  • Can you pass flags to the command that docker runs?
  • 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
    

  • Php application started working slowly with docker
  • Working monitoring solution for Docker Containers and Swarm?
  • Where can I configure the start user UID for Docker containers?
  • Linkerd, k8s and routing
  • How to solve Docker permission error when trigger by Jenkins
  • boot2docker on windows - Can't access exposed port
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.