gpt4 book ai didi

azure - 如何从 GitLab 容器注册表将 Docker 容器部署到 Azure 应用服务

转载 作者:行者123 更新时间:2023-12-02 19:48:59 24 4
gpt4 key购买 nike

我在 GitLab 上托管了一个应用程序,并设置了 GitLab CI 来构建我的 docker 镜像并将其推送到 GitLab 容器注册表中。现在,我想将该容器镜像部署到 Azure 应用服务中,而不使用 Azure 容器注册表(我不想拥有另一个注册表)。这可能吗?如何实现?

谢谢

编辑:

我尝试了这样的方法,但没有成功。 enter image description here

出现此错误:

2020-05-27T14:31:32.739Z INFO  - Pulling image: project1_administration:latest

2020-05-27T14:31:33.098Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://registry-1.docker.io/v2/library/project1_administration/manifests/latest: unauthorized: incorrect username or password"}

2020-05-27T14:31:33.099Z ERROR - Pulling docker image project1_administration:latest failed:

2020-05-27T14:31:33.100Z INFO - Pulling image from Docker hub: library/project1_administration:latest

2020-05-27T14:31:33.577Z ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for project1_administration, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}

2020-05-27T14:31:33.580Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

2020-05-27T14:31:33.586Z INFO - Stopping site project1test because it failed during startup.

当我连接到 gitlab 站点时,我使用的用户名和密码有效。看起来它正在尝试使用 Docker hub 来拉取镜像而不是 GitLab。

最佳答案

假设您的镜像已位于 GitLab 的容器注册表中:

  1. 要从 Azure 访问您的 GitLab 注册表镜像,您需要做的第一件事是创建一个部署 token (在“设置”->“存储库”下)。复制用户名和密码(您将无法再次访问密码)。确保 token 具有 read_registry范围。
  2. 在 Azure 中,创建容器 Web 应用程序。在“Docker”选项卡下,选择“私有(private)注册表”。
  3. 按如下方式设置选项:
  • 服务器网址:https://registry.gitlab.com
  • 用户名:在第 1 步中从部署 token 复制的用户名
  • 密码:在第 1 步中从部署 token 复制的密码
  • 图像和标签:registry.gitlab.com/<username>/<repo>:latest

关于azure - 如何从 GitLab 容器注册表将 Docker 容器部署到 Azure 应用服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62042562/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com