I have a docker-compose file
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"
and a MySQL script to initialize the DB.
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`)
);
Actually Docker ignore the file INIT_DB.SQL as stated:
mysql | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/DB_INIT.SQL
I want to initialize the DB with that file. I've also tried that: tomcat + mysql + war using docker-compose.yml.
Where's the mistake?
docker-entrypoint.shrecognizes*.sh,*.sqland*.sql.gzfiles as init files.*.SQLis not among them (Linux is case-sensitive), so it is ignored.docker-compose rm -vf