I installed latest Docker CS, got a LAMP image from Docker Hub. I'm trying to create a DB in it and make a new image with that DB saved in it.
- Start the container:
docker run --name mycontainer fauria/lampThis starts the Ubuntu-based container and starts Apache server. MySQL server is also running in the container. - Access container shell:
docker exec -i -t mycontainer bash - Create a DB and run a few commands MySQL commands on it:
mysql -u rootCREATE DATABASE mydbname;USE mydbname;CREATE FUNCTION ...... - Stop the container:
docker stop mycontainer - Create an image:
docker commitdocker ps -l -qmynickname/appname:v1 - Remove the container
docker container rm mycontainer
Now I expected that if I run the container based on the new image I'd have the database there already. But it's not there.
docker run --name mycontainer --rm -p 80:80 -e LOG_STDOUT=true -e LOG_STDERR=true -e LOG_LEVEL=debug -v /home/username/dev/appname/www:/var/www/html mynickname/appname:v1
What am I missing?