I'm trying to create a setup where when I do a "docker run" off a Dockerfile that I've created, docker will install and setup mysql, and then create a database for me to use.
Below is my simple docker file that pulls from the existing dockerfile/mysql
FROM dockerfile/mysql
COPY dbsetup.sql /tmp/dbsetup.sql
RUN bash -c "/usr/bin/mysqld_safe &" && \
sleep 5 && \
mysql -u root -e "CREATE DATABASE mydb"
It seems to run, but when I connect to the DB (using the IP I received from the boot2docker ip
command), the database doesnt' exist.
Anyone have any ideas?
Note: I had originally tried to run all three of those commands in separate RUN statements, but that didn't work. Explanation of why here.