Using Docker volumes is the preferred method of locally storing container data. Volume support is built directly into Docker, making it an easy tool to use for storage, as well as more portable. However, storing container data in Docker volumes still requires us to back up the data in those volumes on our own. There is another option: storing our container data in the Cloud. It’s not a solution for every problem, but this lab demonstrates another tool at our disposal.
This lab shows how to mount a Blob Storage container onto our local system as a directory. We will then mount that directory into our Docker container. We will use an httpd container to serve the contents of that bucket as a webpage, but we can use it to share any common data between containers. This will demonstrate how flexible Docker can be. We can make changes to our bucket, and all our containers using the Blob Storage container will near-instantly have access to the content.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Configuration and Installation
- Obtain Azure authentication credentials by using the Azure command line utility.
Note: Use the website, and authentication code in the terminal to get a login page, then use the portal login credentials provided in the lab.
- Set the environment variables
AZURE_STORAGE_ACCOUNT
, andAZURE_STORAGE_ACCESS_KEY
. - Install Microsoft’s repository, available from
https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
.- Install
blobfuse
. - Configure FUSE to allow all users to mount the storage.
- Install
- Obtain Azure authentication credentials by using the Azure command line utility.
- Prepare the Storage
- Create a mount point on the server at
/mnt/widget-factory
and change its ownership to your user. - Mount the Azure Blob Storage Container to the new mount point using
blobfuse
. - Copy the website files to the Blob Storage Container.
- Verify that the files are present on the cloud.
- Create a mount point on the server at
- Use the Storage in a Container
- Run an
httpd
container to serve the website. Remember to mount the Blob Storage to the container and publish the web server port. - View the webpage in a browser. Use the server’s public IP provided with the lab.
- Run an