简体   繁体   English

Docker 与指定主机组合从错误的注册表中提取

[英]Docker compose with specified host pulls from wrong registry

I am playing with Gitlab CI CD and docker.我正在玩 Gitlab CI CD 和 docker。 So far I have the following setup:到目前为止,我有以下设置:

  • A server with gitlab-runner (docker executor)带有 gitlab-runner 的服务器(docker executor)
  • A staging server with docker installed安装了 docker 的登台服务器
  • A self-hosted GitLab instance自托管 GitLab 实例

After building and pushing images to the container registry, I am trying to deploy the app on a staging server by doing following steps:在构建映像并将其推送到容器注册表后,我尝试通过执行以下步骤将应用程序部署在临时服务器上:

    - eval $(ssh-agent -s)
    - echo "$DEPLOY_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY_IMAGE
    - docker-compose -H "ssh://$DEPLOY_USER@$DEPLOY_SERVER" down --remove-orphans || true
    - docker-compose -H "ssh://$DEPLOY_USER@$DEPLOY_SERVER" pull
    - docker-compose -H "ssh://$DEPLOY_USER@$DEPLOY_SERVER" up -d

It fails on the 4th step, where as far as I understood, it points to wrong container registry:它在第 4 步失败,据我了解,它指向错误的容器注册表:

error during connect: Get "http://docker.example.com/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3D repo_name %22%3Atrue%7D%7D&limit=0": command [ssh -l deployer -- staging-server-ip docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=Host key verification failed.连接期间出错:获取“http://docker.example.com/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3D repo_name % 22%3Atrue%7D%7D&limit=0": command [ssh -l deployer -- staging-server-ip docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later安装在远程主机上:stderr=主机密钥验证失败。

Do I have to run docker login on a staging server as well, or what am I missing?我是否还必须在登台服务器上运行docker login ,或者我错过了什么?

It turns out that there were several issues:结果发现有几个问题:

  1. Make sure to use the correct ssh key确保使用正确的 ssh 密钥
  2. I had to run docker on the deployment server in rootles mode (Not sure if it's required)我必须在 rootles 模式下在部署服务器上运行 docker(不确定是否需要)
  3. Also, on a client machine from where we try to connect to the deployment server, I had to disable strict host key checks in the /etc/ssh/ssh_config此外,在我们尝试连接到部署服务器的客户端计算机上,我必须在/etc/ssh/ssh_config中禁用严格的主机密钥检查

暂无
暂无

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

相关问题 是否可以跟踪 Google Artifact Registry 中 docker 的拉取次数? - Is it possible track the number of docker pulls in Google Artifact Registry? Docker-compose:如何使用相同的网络地址从容器和主机访问 Localstack 资源 - Docker-compose: How to access Localstack resources both from container and host, using same network address NGINX docker-compose - 在上游 nuxt:3000 中找不到主机 - NGINX docker-compose - Host not found in upstream nuxt:3000 如何使用 CI/CD 为 Gitlab 注册表推送基于 docker 组合的图像 - How can I push docker compose based images for Gitlab Registry Using CI/CD 如何将 docker-compose 所需的多个图像推送到 GitLab CI 中的 GitLab 注册表? - How to push multiple images needed for docker-compose to GitLab registry in GitLab CI? 如何将 docker 图像从私有第三方注册表迁移到 Google 神器注册表? - How to migrate docker images from private third party registry to Google artifact registry? 无法从 docker 构建中的工件注册表安装私有依赖项 - Cannot install private dependency from artifact registry inside docker build 无法从 Azure 注册表中的 docker 图像运行 Azure Web 服务 - Unable to run Azure Web Service from a docker image in an Azure Registry docker-compose.yml 在单个 Google Compute Engine VM 上指定的多个服务 - Multiple Services Specified by docker-compose.yml on a Single Google Compute Engine VM 如何将 Docker 映像从 GitLab CI 注册表部署到 Amazon ECS? - How to deploy a Docker image from GitLab CI registry to Amazon ECS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM