官术网_书友最值得收藏!

Creating Azure Files SMB share

Assuming that you are following along with these examples on a fresh Azure subscription, let's create an Azure Resource Group and Azure Storage Account first:

  1. In a PowerShell window, execute the following code:
az group create `
--name docker-storage-resource-group `
--location westeurope

You can choose a location that is the most suitable for you (in order to show a list of available locations, run az account list-locations). In this example, we are using the westeurope Azure location.

You can also use the PowerShell script in this book's GitHub repository to do this: https://github.com/PacktPublishing/Hands-On-Kubernetes-on-Windows/blob/master/Chapter02/01_CreateAzureFilesSMBShare.ps1 . Remember to run this script as an Administrator since global mappings for SMB share must be added from a privileged account.
  1. After the successful creation of an Azure Resource Group, continue by creating an Azure Storage Account:
az storage account create `
--name dockerstorageaccount `
--resource-group docker-storage-resource-group `
--location westeurope `
--sku Standard_RAGRS `
--kind StorageV2

The preceding command will create a general-purpose v2 storage account with read-access geo-redundant storage called dockerstorageaccount in docker-storage-resource-group. This operation can take up to a few minutes to complete.

  1. Next, you have to create the actual Azure Files SMB share. First, create a connection string for your Azure Storage Account and store it as a variable in PowerShell:
$azureStorageAccountConnString = az storage account show-connection-string `
--name dockerstorageaccount `
--resource-group docker-storage-resource-group `
--query "connectionString" `
--output tsv

if (!$azureStorageAccountConnString) {
Write-Error "Couldn't retrieve the connection string."
}

Remember to keep the connection string safe as it can be used to manage your storage account!

  1. Using the connection string stored in the $azureStorageAccountConnString variable, create the share:
az storage share create `
--name docker-bind-mount-share `
--quota 2 `
--connection-string $azureStorageAccountConnString

This will create a share called docker-bind-mount-share with a quota limit of 2 GB, which we will now use in our Docker container.

主站蜘蛛池模板: 青龙| 正阳县| 湖南省| 广德县| 砚山县| 肇东市| 横峰县| 登封市| 郸城县| 巴南区| 博白县| 田阳县| 阿荣旗| 白银市| 柯坪县| 蓝田县| 蓬安县| 松滋市| 阿拉善左旗| 平和县| 杨浦区| 兴国县| 河津市| 巨鹿县| 双江| 曲靖市| 隆昌县| 剑川县| 即墨市| 鄂伦春自治旗| 马鞍山市| 奇台县| 平度市| 炉霍县| 河西区| 南乐县| 凌源市| 江门市| 乐亭县| 富裕县| 梁河县|