How to execute scripts after docker-compose up? : <p>I'm trying to make my dev process easier/maintainable using docker(-compose).
I do not want to use any volumes (if that's possible).
Why does import.sh not get executed after I run 'docker-compose up -d'?</p>

<p>I have the following files:</p>

<pre><code>docker-compose.yml
  mysql
  ---- import.sh
  ---- db.sql
  ---- Dockerfile
</code></pre>

<p>in <strong>docker-compose.yml</strong> there is:</p>

<pre><code>version: '2'

services:
  database:
    image: mysql
    build:
      context: ./mysql/
      dockerfile: Dockerfile
    container_name: mysqltest
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: 123456
</code></pre>

<p>in <strong>/mysql/Dockerfile</strong> there is:</p>

<pre><code>ADD import.sh /tmp/import.sh
ADD db.sql /tmp/db.sql
RUN /tmp/import.sh
</code></pre>

<p>in <strong>/mysql/db.sql</strong> there is:</p>

<pre><code>CREATE DATABASE test1;
CREATE DATABASE test2;
CREATE DATABASE test3;
</code></pre>
