I\'m trying to figure out how to implement docker using docker-compose.yml with 2 databases imported from sql dumps.
httpd:
container_name: webserver
After struggling, 3 days found this Article to solve this issue saved my life
File Structure
Project
├── docker-compose.yml (File)
├── init (Directory)
│ ├── 01.sql (File)
then point init directory inside the volumes in the docker-compose.yml file as following
volumes:
- ./init:/docker-entrypoint-initdb.d
01.sql
CREATE DATABASE IF NOT EXISTS `test`;
GRANT ALL ON `test`.* TO 'user'@'%';
docker-compose.yml
version: '3.6'
services:
# MySQL
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
MYSQL_USER: user
MYSQL_PASSWORD: user
volumes:
- ./init:/docker-entrypoint-initdb.d
adminer:
image: adminer
restart: always
ports:
- 8080:8080