how to run docker exec on a docker-compose.yml : <p>I am trying to create a mysql database schema during the docker-compose.yml file is getting executed </p>

<pre><code>  version: "2"
  services:
  web:
    build: docker
    ports:
      - "8080:8080"

  environment:
    - MYSQL_ROOT_PASSWORD=root

   mysql:
   image: mysql:latest
    environment:
     - MYSQL_ROOT_PASSWORD=root
     - MYSQL_DATABASE=test

     ports:
      - "3306:3306"
   links:
    - web

 onrun:
 command: "docker exec -i test_mysql_1 mysql -uroot -proot test &lt;dummy1.sql"
</code></pre>

<p>I tried onrun but this is not working .
i am building the first image but pulling the second image from the docker hub.
kindly help in how to execute the following command after the docker-compose up </p>
