简体   繁体   English

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

[英]How to deploy a Docker container to Azure App Service from GitLab container registry

I have an application hosted on GitLab and have set the GitLab CI to build my docker image and push it into GitLab Container registry. I have an application hosted on GitLab and have set the GitLab CI to build my docker image and push it into GitLab Container registry. Now I want to deploy that container image into Azure App Service without using Azure Container Registry (I don't want to have another registry).现在我想将该容器映像部署到 Azure 应用服务中,而不使用 Azure 容器注册表(我不想拥有另一个注册表)。 Is this possible and how?这可能吗?如何?

Thanks谢谢

EDIT:编辑:

I tried like this and it's not working.我试过这样,但它不工作。 在此处输入图像描述

With this error:出现此错误:

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.

The username and password I used works when I connect to gitlab site.当我连接到 gitlab 站点时,我使用的用户名和密码有效。 It seems it is trying to use Docker hub to pull the image not the GitLab.似乎它正在尝试使用 Docker 集线器来拉取图像,而不是 GitLab。

You can do that, You need to choose private container registry in the appservice and then pass the credentials您可以这样做,您需要在 appservice 中选择私有容器注册表,然后传递凭据

Make sure you are passing the full name of the image registry registry.gitlab.com//确保您传递的是镜像注册表 registry.gitlab.com//

在此处输入图像描述

Assuming that your imaage is already in the Container Registry in GitLab:假设您的镜像已经在 GitLab 的 Container Registry 中:

  1. To access your GitLab Registry Images from Azure, the first thing you need to do is create a Deploy Token (under Settings -> Repository).要从 Azure 访问您的 GitLab 注册表映像,您需要做的第一件事是创建一个部署令牌(在 Settings -> Repository 下)。 Copy the username and password (you won't be able to access the password again).复制用户名和密码(您将无法再次访问密码)。 Ensure the token has read_registry scope.确保令牌具有read_registry scope。
  2. In Azure, create a Web App for Containers.在 Azure 中,为容器创建一个 Web 应用程序。 Under the Docker tab, choose Private Registry.在 Docker 选项卡下,选择私有注册表。
  3. Set the options as follows:设置选项如下:
  • Server URL: https://registry.gitlab.com服务器URL: https://registry.gitlab.com
  • Username: Username copied from Deploy Token in step 1用户名:在步骤 1 中从 Deploy Token 复制的用户名
  • Password: Password copied from Deploy Token in step 1密码:从步骤 1 中的 Deploy Token 复制的密码
  • Image and tag: registry.gitlab.com/<username>/<repo>:latest图片和标签: registry.gitlab.com/<username>/<repo>:latest /<repo>:latest

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Docker注册表中提取容器映像以部署Azure容器 - How to pull container image from docker registry to deploy azure container How do I authenticate using a managed identity from gitlab-ci to push a docker container from gitlab registry to Azure web service? - How do I authenticate using a managed identity from gitlab-ci to push a docker container from gitlab registry to Azure web service? 将Docker映像从gitlab-ci推送到Azure容器注册表 - Pushing Docker image from gitlab-ci to Azure Container Registry 如何从 Azure function 应用程序部署 docker 容器? - How to deploy a docker container from Azure function app? 在 Azure App Service 问题上部署 Docker Container Registry - Deploying Docker Container Registry on Azure App Service Issue 在 azure devops 上创建管道以在 azure 应用服务上部署 docker 容器? - Create a pipeline on azure devops to deploy a docker container on azure app service? 如何使用 Terraform 从 azure 容器注册表中提取和部署 docker 映像? - How to pull and deploy a docker image from azure container registry using Terraform? Azure容器注册表中的Azure App Service连续部署 - Azure App Service continuous deployment from Azure Container Registry Docker 通过服务原理登录到 Azure 容器注册表 - Docker login to Azure Container Registry by Service Principle Powershell + Azure 应用服务 + Azure 容器注册表 - Powershell + Azure App Service + Azure Container Registry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM