代码之家  ›  专栏  ›  技术社区  ›  dq101

无法使用docker.io中的映像创建Azure容器实例

  •  0
  • dq101  · 技术社区  · 1 年前

    我们有一个配置为从docker镜像创建容器实例的azure yaml管道,它在7月1日(昨天)之前运行良好,但从7月2日(今天)开始,管道中出现了以下错误:

    错误:(RegistryErrorResponse)从docker注册表“docker.io”收到错误响应。请稍后重试。 代码:注册表错误响应 消息:从docker注册表'docker.io'收到错误响应。请稍后重试。

    这就是 AzureCLI@2 用于创建容器的任务:

    - task: AzureCLI@2
      name: CreateContainer
      displayName: Create container
      inputs:
        azureSubscription: ${{ parameters.subscription }}
        scriptType: bash
        scriptLocation: inlineScript
        inlineScript: |
          az container create \
            --resource-group '${{ parameters.resourceGroup }}' \
            --name '${{ parameters.name }}' \
            --image 'docker.io/mockoon/cli:latest' \
            --ports ${{ parameters.port }} \
            --location '${{ parameters.location }}' \
            --dns-name-label '${{ parameters.name }}' \
            --command-line "mockoon-cli start --data '$(publicUrl)' --port ${{ parameters.port }}"`
    

    我尝试过使用不同的标签,例如。 8.2.0 , 8.1.1 ,结果相同 我已经检查了这里的状态 https://www.dockerstatus.com/ 这是“所有系统都在运行”

    0 回复  |  直到 1 年前
        1
  •  2
  •   Renan Besserra Lago de Noronha    1 年前

    Docker Hub的速率限制策略发生了变化,该策略被更改为管理其基础设施上的负载并防止滥用。6月30日,利率发生了变化,具体如下:

    匿名用户每6小时最多可以提取100张图像。

    经过身份验证的用户(具有Docker帐户)每6小时最多可以提取200个映像。

    拥有付费Docker许可证的用户每天最多可以提取5000个映像。

    https://medium.com/@alaa.barqawi/docker-rate-limit-with-azure-container-instance-and-aks-4449cede66dd

        2
  •  0
  •   Bright Ran-MSFT    1 年前

    当我尝试使用Docker Hub的Docker镜像创建ACI时,我可能会收到同样的错误消息。然而,当使用ACR的图像时,它工作得很好。

    作为一种解决方法,您可以尝试使用 DevcontainersCi@0 任务由“ Dev Container Build and Run Task “扩展,然后使用ACR的图像创建ACI。

    1. 安装 开发容器构建和运行任务 扩展到您的Azure DevOps组织。

    2. 在管道运行的git存储库中,添加一个json文件“ .devcontainer/devcontainer.json “根目录中有以下内容。

      {
        "image": "docker.io/mockoon/cli:latest"
      }
      

      enter image description here

    3. 然后按如下方式配置管道。

    steps:
    - task: Docker@2
      displayName: 'Docker Login'
      inputs:
        containerRegistry: 'Name of the Docker Registry service connection' 
        command: login
    
    - task: DevcontainersCi@0
      displayName: 'Build and Run Dev Container'
      inputs:
        imageName: yourregistry.azurecr.io/mockoon_cli
        imageTag: 'latest'
        push: filter
        sourceBranchFilterForPush: refs/heads/main
        noCache: false
    
    - task: AzureCLI@2
      displayName: 'Create ACI'
      inputs:
        azureSubscription: 'Name of the ARM service connection'
        scriptType: 'bash'
        scriptLocation: 'inlineScript'
        inlineScript: |
          az container create \
          -g '${{ parameters.resourceGroup }}' \
          -n '${{ parameters.name }}' \
          -l '${{ parameters.location }}' \
          --ports ${{ parameters.port }} \
          --dns-name-label '${{ parameters.name }}' \
          --registry-username $(username) \
          --registry-password $(password) \
          --image 'yourregistry.azurecr.io/mockoon_cli:latest' \
          --command-line "mockoon-cli start --data '$(publicUrl)' --port ${{ parameters.port }}"`