我正在将用于构建和部署GitLab CI/CD的Docker映像集合从Dockerhub移植到AWS公共ECR。除了我们作为码头服务使用的标准码头形象之外,一切都按应有的方式工作。从Dockerhub中提取的相同图像在从公共ECR中提取时无法登录。
..gitlab ci.yml
build-push:
stage: package
image: public.ecr.aws/x/x
services:
- public.ecr.aws/x/docker-dind:20.10$ aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_DOCKER_REGISTRY_URL
> Logging in to Docker registry...
> error during connect: Post http://docker:2375/v1.24/auth: dial tcp: lookup docker on 8.8.8.8:53: no such host$ cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 public.ecr.aws__*
172.17.0.2 public.ecr.aws-*
172.17.0.3 runner-*谢谢。
发布于 2021-08-11 21:23:33
要解决这个问题,只需在/etc/gitlab/config.toml上添加一个到坞袜子的卷映射即可。
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]发布于 2021-09-22 14:11:01
在gitlab-ci中构建码头映像时,必须添加以下内容(dind用于“码头对接”):
services:
- docker:dind发布于 2021-02-07 00:07:40
这可能是您的Docker环境配置错误。出于某种原因,它似乎正在通过docker (从http://docker:2375/v1.24/auth URL)解析8.8.8.8名称服务器。这显然行不通。
尝试在您的120.0.0.1 docker中添加/etc/hosts记录--这可能会有所帮助。
https://serverfault.com/questions/1052496
复制相似问题