[英]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:到目前为止,我有以下设置:
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:结果发现有几个问题:
/etc/ssh/ssh_config
此外,在我们尝试连接到部署服务器的客户端计算机上,我必须在/etc/ssh/ssh_config
中禁用严格的主机密钥检查
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.