top of page
  • Writer's picturekyle Hailey

Docker Data Containers


photo by

The appeal of Docker is clear.

The Docker platform enables multiple applications to run concurrently on a single copy of an OS, either deployed directly onto a physical server or as a virtual machine (VM).

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.

Here is a video explaining a little of the problem and possible future solutions.

But what if you want a solution now?  A solution now is available with Delphix. 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.

In this example I will be using Delphix Express version and the Landshark source and target environment and will be using a wordpress docker container that points to a persistent MySQL data store..

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.

On the Source

ssh  delphix@source

# password is delphix

su –

# password is delphix

vi /etc/my.cnf

#add line “user=root” then save file

service mysqld start

mysql -u root -p


CREATE USER wordpressuser;

SET PASSWORD FOR wordpressuser= PASSWORD(“password”);

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ‘password';



Then start docker and download the “wordpress” container

service docker start

docker pull wordpress

Start docker wordpress container

docker run -p 80:80 –name wordpress  \

           -e WORDPRESS_DB_HOST= \

           -e WORDPRESS_DB_USER=wordpressuser \

           -e WORDPRESS_DB_PASSWORD=password \

           -d wordpress

Now, on the source machine, we have a docker wordpress container using a persistent MySQL database for storage.


Now to move this docker container to another host, we can link in the MySQL database to Delphix. Once linkedin, we can provision a copy out to any registered host.

In Delphix, I just click + in the top left to add a datasource. The MySQL database should show up in the top of source.

Screen Shot 2015-11-19 at 4.49.43 PM

Screen Shot 2015-11-19 at 4.50.17 PM

Once linking is finished we can provision the MySQL out to another target machine and startup a new docker container pointing to this new virtual MySQL database (VDB).

I just click on the dSource on the left, then on the right click on provision and choose the target machine and a port. I’ll use 3306 for the port.

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 start

docker pull wordpress

docker run -p 80:80 –name wordpress \

           -e WORDPRESS_DB_HOST= \

           -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 -P 3306 wordpress << EOF

update wp_options set option_value=’′ where option_id<3;

select option_value,option_id from wp_options where option_id < 4;


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.

2 views0 comments


bottom of page