I want create dockerFile, that will build image, that contains some data_preset, so mysql is not empty;
I create some mysqlDump files and put them in
basefolderMake DockerFile
FROM mysql:5.7
RUN mkdir /dbsheme
COPY /base/ /dbsheme
RUN /bin/bash -c "/usr/bin/mysqld_safe --skip-grant-tables &" && \
sleep 5 && \
mysql -u root -e "CREATE DATABASE main" && \
mysql -u root -e "CREATE DATABASE shard1" && \
mysql -u root -e "CREATE DATABASE docker" && \
mysql -u root main < /dbsheme/main.db && \
mysql -u root shard1 < /dbsheme/shard1.db
CMD ["mysqld"]
Build docker image
docker build . -t my_customRun image
docker run --name mysql_with_dump -v db/docker/data:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -d my_customLook inside the container and it is default mysql without my tables and dump. What did i wrong with setup?