Containerize your database volume with Tutum MySQL Images

Tutum Blog

Nowadays, there are more and more people starting to use docker to containerize their applications, and MySQL is the most popular one.It is as simple as one command line to create and start your own database:

docker run -d –P tutum/mysql

However if you decide to replace MySQL with MariaDB in the future, data migration will be painful to perform. Tutum MySQL/MariaDB images help solve this problem.

Here is a simple example:

1. Create a volume container that holds database data

docker run -d -v /var/lib/mysql –name db_vol -p 22:22 tutum/ubuntu:trusty

Note: you can change the name of the volume container, which will be used in the next step. The volume path (/var/lib/mysql) should not be changed.

2. Create a MySQL container and write data to the volume container:

docker run -d –volumes-from db_vol -p 3306:3306 tutum/mysql:5.5

Note: –volumes-from should use the name of the volume container.

Here’s the log…

View original post 161 more words

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s