[Docker] Storing Container Data in Azure Blob Storage
Docker in Data Azure Storage container blob
2023-09-14 08:59:11 时间
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.
相关文章
- Docker的基本使用——常用docker命令
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- 宝塔Docker部署RSShub
- Docker部署_docker部署网站
- Docker容器实战七:镜像仓库
- 通过 docker 高效学习 nginx 配置,并附全部配置文件
- docker的端口映射_docker swarm 网络
- Docker 构建私有镜像仓库
- 「 【Docker】linux安装docker compose(小白安装) 」
- Windows系统安装Docker遇到error during connect: In the default daemon configuration on Windows, the docker
- 容器的崛起——Docker与K8s的相爱相杀
- docker | dockerfile指令详解
- django 项目部署用到的docker-compose 文件详解程序员
- Docker Compose命令详解架构师
- MySQL删除IN操作: 简易指南(mysql删除in)
- 条件不将Oracle中的空值纳入IN条件中(oracle空值in)
- 操作MySQL中In操作指南(mysql中in)
- 如何自定义容器网络?- 每天5分钟玩转 Docker 容器技术(33)
- 利用Oracle中IN运算符的优势(oracle中in的作用)
- MySQL中IN查询的使用方法(mysql查询in)
- 解析MySQL中IN操作符的实现原理(mysql中in的原理)
- MySQL中如何使用IN操作符(mysql中in怎么写)
- 优化MySQL查询避免使用IN关键字(mysql 不用 in)