photo by www.GlynLowe.com
One challenge with Docker is having persistent storage for a container especially when that container gets restarted on another VM host and we want it to point to the same data. If we add in Delphix with Docker we can easily move persistent data and a docker container to a new host.
For the docker container we will use wordpress that leverages a MySQL database for it’s persistent datastore.
The source and target machines already have docker and MySQL on them, so all we need to do is start MySQL, create a wordpress schema, start docker, get the docker wordpress container, then start a docker container with wordpress and point to the MySQL database.
ssh delphix@source# password is delphixsu –# password is delphixvi /etc/my.cnf#add line “user=root” then save fileservice mysqld startmysql -u root -pCREATE DATABASE wordpress;CREATE USER wordpressuser;SET PASSWORD FOR wordpressuser= PASSWORD(“password”);GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ‘password';FLUSH PRIVILEGES;exit
Then start docker and download the “wordpress” container
Start docker wordpress container
Now, on the source machine, we have a docker wordpress container using a persistent MySQL database for storage.

Now I have a thin clone of the MySQL database, a virtual database (VDB), running on the target machine. I just need to create a docker wordpress container to use it.
service docker startdocker pull wordpressdocker run -p 80:80 –name wordpress \
-e WORDPRESS_DB_HOST=172.16.160.161:3306 \-e WORDPRESS_DB_USER=wordpressuser \-e WORDPRESS_DB_PASSWORD=password \-d wordpress
Now I can access my wordpress blog on my target machine and modify it separately from the source. If the target machine goes down, I can migrate the VDB to another host and startup the container there and point the wordpress container to the same VDB now running on a new host.
One other change I made on the target VDB is changing the siteurl and home to be the new IP of the target machine:
mysql -u wordpressuser -ppassword -h 172.16.160.161 -P 3306 wordpress << EOF
update wp_options set option_value=’http://172.16.160.161′ where option_id<3;
select option_value,option_id from wp_options where option_id < 4;
EOF
From here we can set up architectures where the source is hosted directly on Delphix and Delphix can manage version controlling the source MySQL database and WordPress application.
We can spin out multiple VDBs in minutes for almost no storage to give to multiple developers to try modifications and merges of changes on.