社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  docker

无法从Azure注册表中的docker映像运行Azure Web服务

Jay • 3 年前 • 1223 次点击  

我试图通过在Azure DevOps中创建一个管道来自动化我的部署过程,该管道执行以下操作

  1. 构建我的项目,创建docker映像,然后将映像推送到专用Azure注册表服务。
  2. 将映像部署到名为 staging 在Azure Web服务中。

这是 .yaml 我正在使用的文件

trigger:
- master

resources:
- repo: self

variables:
  dockerRegistryServiceConnection: 'MyPrivateRegistry'
  imageRepository: 'MyPrivateRepositoryName'
  containerRegistry: 'MyPrivateRepositoryName.azurecr.io'
  dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
  tag: '$(Build.BuildId)'
  azureSubscription: 'MyPrivateSubscribtionName(5c4b9a4b-private-subscribtion-id-91503531e1a0)'
  appName: 'private_appname'
  resourceGroupName: 'PrivateResourceGroup'
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Push and Build
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: Docker@2
      displayName: Build and push an image
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: '$(dockerRegistryServiceConnection)'
        tags: |
          $(tag)
  - job: DeployToStaging
    displayName: Deploy To staging
    dependsOn: Build
    condition: succeeded()
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: AzureWebAppContainer@1
      inputs:
        azureSubscription: $(azureSubscription)
        appName: $(appName)
        deployToSlotOrASE: true
        resourceGroupName: $(resourceGroupName)
        slotName: 'staging'
        containers: '$(containerRegistry)/$(imageRepository):$(tag)'

项目成功构建,并按预期推送到私有注册表。我可以验证是否使用新的tagId推送了新图像。但是,我的容器无法启动,出现以下错误

由于Inspect Image返回null:MyPrivateRepositoryName,映像拉取失败。阿祖列克。io/MyPrivateRepositoryName:151

这是我看到的建议

Please check the repository name, image name, and container definitions defined by DOCKER_REGISTRY_SERVER_USERNAME, DOCKER_REGISTRY_SERVER_URL, and DOCKER_REGISTRY_SERVER_PASSWORD.

当我转到临时插槽配置时,我会看到以下内容,并且这些值都是正确的。启用Admin用户后,我从Container Registry服务的“Access keys”部分复制了这些值

我错过了什么?如何获取插槽以正确地从包含注册表中提取docker映像?

enter image description here

已更新

查看更多日志会发现此错误

2022-04-01T20:36:21.409Z ERROR - Pull image threw Exception: Input string was not in a correct format.
2022-04-01T20:36:21.411Z INFO  - Pulling image from Docker hub: privateregistry.azurecr.io/privateimage:152
2022-04-01T20:36:21.594Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://privateregistry.azurecr.io/v2/privateimage/manifests/152: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."}

听起来好像有什么东西没有权限从存储库中提取docker映像。问题是什么对象需要此权限?我会将权限添加到的私有存储库吗?我会将其添加到Web服务吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/135351
 
1223 次点击  
文章 [ 1 ]  |  最新文章 3 年前