0

在不使用任何 Docker 注册表集成的情况下创建了 Azure 应用服务 Web 应用。

我想在下面实现。

1] 在我的 Linux 机器上创建、标记映像 2] 使用以下命令将本地 Docker 映像部署到应用服务 Web 应用

az webapp config container set --name springboot-docker-helloworld-app --resource-group SpringBoot --docker-custom-image-name org/dockerspringtboot-metinv:latest

但它不起作用。

是否可以将本地 Docker 映像部署到 Azure 应用服务 Web 应用?

4

1 回答 1

1

你需要将容器映像推送到 Azure 容器注册表,你的 Azure Web 应用可以从中提取映像。

您可以使用 Azure CLI 执行此操作,步骤如下:

$ az acr create --resource-group your_rg \
                --name yourAcrName --sku Basic 

# login to the container registry locally
$ az acr login --name yourAcrName 

# update the container registry to use admin-enabled 
# https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli#admin-account
$ az acr update -n yourAcrName --admin-enabled true

# tag your local image to the container registry
$ docker tag dockerspringtboot-metinv:latest yourAcrName/dockerspringtboot-metinv:latest

# push image to your container registry
$ docker push yourAcrName/dockerspringtboot-metinv:latest

然后,您可以创建应用服务计划并部署指定使用容器注册表的 Web 应用。

$ az appservice plan create -g your-rg \
                            -n your-app-plan \
                            --sku B1 --is-linux 

# deploy your container as an app in the created App Service plan
$ az webapp create -g your-rg \
                   -p your-app-plan \
                   -n dockerspringtboot \
                   -i yourAcrName/dockerspringtboot-metinv:latest

于 2021-10-19T10:06:23.033 回答