One of the hardest problems in any Docker cluster deployment (Swarm, Kubernetes, etc.) is unlocking storage for the host and exposing it to the entire cluster. For example, if you are running PostgreSQL on a node within a cluster and that node fails, or the PostgreSQL container gets rescheduled on another node you will want your data to persist. In a traditional environment, this data that was on the host will be lost. However, by using an external service we can seamlessly remount that disk to another host and continue running the service.

Docker allows administrators to plug in their storage backend using a Volume Driver. RexRay is a popular volume driver out of {code} by Dell EMC which builds on top of libstorage. RexRay integrates with Amazon Web Services Elastic Block Storage and Elastic File System services and exposes those services as Docker volumes. Below is an example of how to get started using the driver.

Create an Instance Profile

First, our instance needs to have permission to create, attach, detach, and manage EBS and EFS mount points. Attach the following policy to an AWS Instance Profile to grant the instance implicit access to the following AWS APIs.

Launch and Configure the Instance

Next, we will launch an instance using the instance profile we created above and run the following command after install Docker.

Using the Plugin

Now that we have Docker and RexRay installed with the proper permissions we can begin using the driver.

Conclusion

RexRay, along with many other Volume Drivers, aid in unlocking persistent storage from the host and creating cluster level persistent storage. By integrating with AWS EFS and EBS we expose AWS services directly within the container just as AWS exposes it to the instance. Feel free to reach out with any questions on Twitter to Alex or Alicia!