Download Docker and boot2docker from https://www.docker.com/
boot2docker init
Follow the directions on the screen to set the DOCKER_HOST
###Create a data container for the web application
docker run -v /app --name app ubuntu true
###Create a data container for MySQL
docker run -v /var/lib/mysql --name data ubuntu true
docker run -d -p 3306:3306 --volumes-from data -e MYSQL_ROOT_PASSWORD="changeme" --name db mysql
Note: modify MYSQL_ROOT_PASSWORD="changeme"
to set a root password for your MySQL instance.
docker run -d --link db:db -p 8080:80 --volumes-from app --name web tutum/apache-php
boot2docker ip
##On each run
###Boot boot2docker
boot2docker up
docker start db web
docker run --rm -v /usr/local/bin/docker:/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba app
boot2docker ip
Using the address returned from boot2docker ip
, connect to the app Samba (Windows) share. On OSX, activate Finder and press Command-K or select Go->Connect to Server... In the address bar, enter smb://smb://192.168.59.103/app and click connect. A volume will be then mounted at /Volumes/app
Using the address returned from boot2docker ip
, connect to the MySQL server. The username is root and the password is the root password you set for MYSQL_ROOT_PASSWORD
.
To use MySQL, first create a new table and user using your MySQL client of choice. When connecting the web application to the MySQL server, use db for the hostname.
Your web application is running on port 8080. To connect to it via browser, use http://YOUR-BOOT2DOCKER-IP:8080.
boot2docker down