I want to create a MySQL container with an initial database and its tables, from a Dockerfile.
I also have a specific /etc/mysql/mysql.conf.d/mysqld.cnf file (I can simply use ADD directive in Dockerfile.)
I want my Dockerfile to create a MySQL image with a database named, for example, DBNAME and with the following tables:
CREATE TABLE utente (
     ID int  NOT NULL AUTO_INCREMENT,
     nome VARCHAR(255),
     cognome VARCHAR(255),
     username VARCHAR(255),
     password VARCHAR(255),
     PRIMARY KEY (ID)
);
CREATE TABLE sdplines (
    ID int NOT NULL AUTO_INCREMENT,
    value VARCHAR(255),
    session_id VARCHAR(255),
    u_id int,
    PRIMARY KEY (ID),
    FOREIGN KEY (u_id) REFERENCES utente(ID)
);
I've already searched to solve my problem here but I've found no solution.
 
     
     
    