title: Docker-compose initialize DB
body: <p>I have a docker-compose file </p>
  
  <pre><code>version: '3.7'
  
  services:        
    db:
        image: mysql:latest
        container_name: mysql
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 12345
        volumes:
          - ./docker/db:/docker-entrypoint-initdb.d
        ports:
          - "3306:3306"
  </code></pre>
  
  <p>and a MySQL script to initialize the DB.</p>
  
  <pre><code>CREATE DATABASE `aaa`;
  USE `aaa`;
  
  
  CREATE TABLE `building` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(45) NOT NULL,
    `start_date` date DEFAULT NULL,
    `end_date` date DEFAULT NULL,
    `open` tinyint(4) DEFAULT NULL,
    `address_type` varchar(30) DEFAULT NULL,
    `address_name` varchar(45) DEFAULT NULL,
    `address_number` varchar(45) DEFAULT NULL,
    `cap` char(5) DEFAULT NULL,
    `city` varchar(45) DEFAULT NULL,
    `province` varchar(45) DEFAULT NULL,
    `state` varchar(45) DEFAULT NULL,
    `req_amount` float DEFAULT NULL,
    PRIMARY KEY (`id`)
  );
  </code></pre>
  
  <p>Actually Docker ignore the file INIT_DB.SQL as stated:</p>
  
  <pre><code>mysql | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/DB_INIT.SQL
  </code></pre>
  
  <p>I want to initialize the DB with that file. I've also tried that: <a href="https://stackoverflow.com/questions/53701629/tomcat-mysql-war-using-docker-compose-yml">tomcat + mysql + war using docker-compose.yml</a>. </p>
  
  <p>Where's the mistake?</p>