I was able to complete the task of adding a database to the tutum-docker-mysql image by following these steps.
git clone https://github.com/tutumcloud/tutum-docker-mysql.git cd tutum-docker-mysql vi create_mysql_admin_user.sh
Inside this .sh file, I added a line located directly beneath the two "mysql -uroot" lines that already exist. I just added:
mysql -uroot -e "create database test;"
After this change in this .sh file, I just built a docker image.
docker build -t tutum/mysql .
After the docker image was built, I could run it with something like:
docker run -d -p 3307:3306 tutum/mysql
Once the container is running, you need to know the password to use and the IP address of the container. To get the password, you simply do
docker logs 2976a81f1a9b19787d9bde893c831b7e6586d7c8391ccd222ad29b02c282d896
But, of course, use the identifier of the container that was returned from the docker run command above. Now that you have a password, you need an IP address. I understand what I'm doing.
docker inspect 2976a81f1a9b19787d9bde893c831b7e6586d7c8391ccd222ad29b02c282d896
And look at the address "Gateway". With the password and ip address, I was able to execute this mysql command from the OUTSIDE container.
mysql -uadmin -pJcM5FCphMOp4 -h172.17.42.1 -P3307
Where the IP address and password are the values I got from the two previous docker commands. After running this command, I can then run the "show databases" command with the following results.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) mysql>
I struggled for a while trying it by modifying the Docker file. I think this is possible, but after a while I found the solution above is much faster and easier.