[Docker] Storing Container Data in Azure Blob Storage
Configuration and Installation
- Obtain the Azure login credentials:
az login
- Copy the code provided by the command.
- Open a browser and navigate to https://microsoft.com/devicelogin.
- Enter the code copied in a previous step and click Next.
- Use the login credentials from the lab page to finish logging in.
- Switch back to the terminal and wait for the confirmation.
Prepare the Storage
- Find the name of the Storage account:
az storage account list | grep name | head -1
- Copy the name of the Storage account to the clipboard.
- Export the Storage account name:
export AZURE_STORAGE_ACCOUNT=<COPIED_STORAGE_ACCOUNT_NAME>
- Retrieve the Storage access key:
az storage account keys list --account-name=$AZURE_STORAGE_ACCOUNT
- Copy the
key1
"value" for later use. - Export the key value:
export AZURE_STORAGE_ACCESS_KEY=<KEY1_VALUE>
- Install
blobfuse
:sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm sudo yum install blobfuse fuse -y
- Modify the
fuse.conf
configuration file:sudo sed -ri 's/# user_allow_other/user_allow_other/' /etc/fuse.conf
Use the Azure Blob Storage Container
- Create necessary directories:
sudo mkdir -p /mnt/widget-factory /mnt/blobfusetmp
- Change ownership of the directories:
sudo chown cloud_user /mnt/widget-factory/ /mnt/blobfusetmp/
- Mount the Blob Storage from Azure:
blobfuse /mnt/widget-factory --container-name=website --tmp-path=/mnt/blobfusetmp -o allow_other
- Copy website files into the Blob Storage container:
cp -r ~/widget-factory-inc/web/* /mnt/widget-factory/
- Verify the copy worked:
ll /mnt/widget-factory/
- Verify the files made it to Azure Blob Storage:
az storage blob list -c website --output table
- Run a Docker container:
docker run -d --name web1 -p 80:80 --mount type=bind,source=/mnt/widget-factory,target=/usr/local/apache2/htdocs,readonly httpd:2.4
- Once the command is complete, open a web browser and navigate to the public IP address of the server.
- Verify the website is up and running.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2019-01-29 [Algorithom] Shuffle an array
2019-01-29 [TypeScript] Work with DOM Elements in TypeScript using Type Assertions
2019-01-29 [Tools] Unlock TypeScript's Features in Vanilla JS with @ts-check and JSDoc
2019-01-29 [Angular] Two things about OnChanges Lifecycle hook
2019-01-29 [Functional Programming 101] runWIth, evalWith, execWith
2019-01-29 [Functional Programming Monad] Modify The State Of A State Monad
2019-01-29 [Functional Programming Moand] Update The State Of A State Monad (put)