FittedCloud AWS EBS Optimizer for Docker Containers

 

As container technology matures and becomes widely accepted, users are increasingly looking for ways to share persistent data storage to satisfy their enterprise workloads such as stateful databases.  Docker and REX-Ray have both grown in popularity as useful solutions in aiding organizations in managing and leveraging external storage solutions.

Docker volume plugins enable containers to be integrated with external storage systems, such as Amazon EBS, and enable data volumes to persist beyond the lifetime of a single host.  This means that a volume can be made available on any host that a container is started on.

REX-Ray is an open source storage management solution designed to support container runtimes such as Docker and Mesos.  Its open architecture has gained support from many storage providers.

FittedCloud is excited to bring its EBS Optimizer technology to the container ecosystem.  By offering thin-provisioned persistent EBS storage through the REX-Ray libStorage framework, users can immediately save money by provisioning the correct, needed amount of storage without overpaying for unused space.

Example of FittedCloud’s Container Solution

Below is an example of containers on two Amazon EC2 instances sharing FittedCloud optimized persistent EBS storage. Detailed setup requirements can be found here.

1. On host-1, create a volume ‘vol1’ of 10GB in size.
docker volume create -d fittedcloud --name vol1 -o size=10

Optimized by the FittedCloud software, a 2GB EBS volume /dev/xvdce appears as a 10GB FittedCloud volume fcv.

fcagent showvolmap
FittedCloud Software Version 2.0, Build 3228
(c) 2015-2016, FittedCloud Inc.
All Rights Reserved

FittedCloud Driver Version 2.0 Build 3228 Built on Feb 01 2017 21:58:02
FC Volume Info:
---------------------------------------------------------------------------
FC VolName      SizeMB       UsedSizeMB     #Disks   Disk Name      FreeLBA
---------------------------------------------------------------------------
fcv             10240        340            1
0               2048         340                     /dev/xvdce      87

 

2. Launch container ‘temp01’ with volume ‘vol1’ mapped to /vol1.
docker run -tid --volume-driver=fittedcloud -v vol1:/vol1 --name temp01 busybox

The volume appears as a 10GB filesystem inside the container.

docker exec -it temp01 busybox df /vol1
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/fcv              10190136     23032   9626432   0% /vol1

 

3. Write 3GB worth of data using dd command inside the container.
docker exec -it temp01 busybox sh -c "dd if=/dev/zero of=/vol1/zero bs=1M count=3096"

A volume expansion is triggered when 75% of the used space is reached. A new 2GB EBS volume is allocated by the FittedCloud driver. This volume expansion is transparent to the applications.

Now two 2GB EBS volumes are allocated and managed by the FittedCloud driver.

fcagent showvolmap
FittedCloud Software Version 2.0, Build 3228
(c) 2015-2016, FittedCloud Inc.
All Rights Reserved

FittedCloud Driver Version 2.0 Build 3228 Built on Feb 01 2017 21:58:02
FC Volume Info:
---------------------------------------------------------------------------
FC VolName      SizeMB       UsedSizeMB     #Disks   Disk Name      FreeLBA
---------------------------------------------------------------------------
fcv             10240        3440           2
0               2048         2040                    /dev/xvdce      512
1               2048         1400                    /dev/xvdcd      351

 

4. On host-1, stop container ‘temp01’.
docker stop temp01

Volume ‘vol1’ is released and the two constituent EBS disks are detached from host-1.

5. On host-2, launch container ‘temp02’ with volume ‘vol1’ mapped to /vol1.
docker run -tid --volume-driver=fittedcloud -v vol1:/vol1 --name temp02 busybox

The volume has a 3GB file previously created by container ‘temp01’.

docker exec -it temp02 busybox ls -l /vol1
total 3170308
-rw-r--r--    1 root     root     3246391296 Feb  2 20:22 zero

 

6. Clean up

Remove container ‘temp01’ and ‘temp02’.

docker rm temp01

docker rm temp02

Remove persistent volume ‘vol1’.

docker volume rm vol1

For those who have questions or are interested in trialing this solution please contact FittedCloud support (mailto:support@fittedcloud.com) and reference the Docker Container Technical Preview Program.  The FittedCloud support team will answer all of your questions and if requested assist you in downloading and installing the software.