title: How to run wp cli in docker-compose.yml
body: <p>Just starting in docker here</p>
  
  <p>So I got this in my <strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '3.3'
  
  services:
    db:
      image: mysql:5.7
      volumes:
        - db_data:/var/lib/mysql
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: somewordpress
        MYSQL_DATABASE: wordpress
        MYSQL_USER: wordpress
        MYSQL_PASSWORD: wordpress
  
    wordpress:
      depends_on:
        - db
      image: wordpress:latest
      ports:
        - 8000:80
      restart: always
      environment:
        WORDPRESS_DB_HOST: db:3306
        WORDPRESS_DB_NAME: wordpress
        WORDPRESS_DB_USER: wordpress
        WORDPRESS_DB_PASSWORD: wordpress
        WORDPRESS_TABLE_PREFIX: "wp_"
        WORDPRESS_DEBUG: 1
  
    wordpress-cli:
      depends_on:
        - db
        - wordpress
      image: wordpress:cli
      command: wp core install --path="/var/www/html" --url=localhost --title="Local Wordpress By Docker" --admin_user=admin --admin_password=secret --admin_email=foo@bar.com
  
  volumes:
    db_data:
  </code></pre>
  
  <p>So I wanted to run the <strong>wp core install</strong> so that I won't have to go through the process of <strong>manually</strong> setting up my test wordpress site.</p>
  
  <p>However when I run <strong>docker-compose up</strong>, this does not seem to work, I got this error on the console</p>
  
  <p><a href="https://i.stack.imgur.com/gggqc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gggqc.png" alt="enter image description here"></a></p>
  
  <p>What am I missing here? Anyone can help me accomplish my goal of <strong>automating the of setting up wordpress install?</strong></p>
  
  <p>Thanks in advance</p>