What is Snap Creator?
Snap Creator is a tool which provides a CLI and GUI and helps you take consistent backups of your applications and or databases.
We will use MySQL DB as a sample for this post.
How do you make sure mysql data is stored in a NetApp volume?
Make sure you mount your NetApp Volume on the Docker Server @ /mnt/mysql_data or at a location of your choice
e.g. >sudo mount -t nfs svm_ip:/mysql_data_vol /mnt/mysql_data
How can I start a Container with MySQL?
You can simply run latest mysql database version in a container with following command:
>docker run –name some-mysql -v /mnt/mysql_data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
Note the -v option and how we give the volume.
How do we enable MySQL backup?
To enable backup of MySQL Database we need to make sure Snap Creator Agent is running in the container.
Steps to enable Snap Creator Agent within the MySQL Container:
1) Install Snap Creator server and agent on the Docker host. (I installed it at /software/snapcreator/)
2) Install docker-compose
>sudo curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
>sudo chmod +x /usr/local/bin/docker-compose
2) Find Snap Creator Agent under : /software/snapcreator/scAgent4.1.2
3) Create a new entrypoint file for our Docker Container:
echo “running sc agent “
echo “running old entrypoint with args”
4) Create a new DockerFile to build our MySQL container with SC Agent enabled
RUN apt-get update
RUN apt-get install -y openjdk-7-jre-headless
COPY new-entry-point.sh /new-entry-point.sh
5) Put both the files Dockerfile and new-entry-point.sh under a folder named mysql-image
6) Create a new docker-compose file
7) Run the following:
> docker-compose build
>docker-compose up -d
8) Now your MySQL Container will start with SC Agent running on port 9090 which is exposed also on the docker host at 9090,(which is configurable in the docker-compose.yml file)
9) Now start Snap Creator Server and create a new config for your MySQl database as usual.
Sample code available here: