简体   繁体   English

Docker 连接期间出现错误:发布 http://docker:2375/v1.40/build?

[英]Docker error during connect: Post http://docker:2375/v1.40/build?

I am using docker+machine to run my gitlab ci/cd jobs.我正在使用 docker docker+machine运行我的gitlab ci/cd 作业。

So my .gitlab-ci.yml looks like below:所以我的.gitlab-ci.yml如下所示:

stages:
  - RUN_TESTS

image:
  name: docker:stable

services:
  - name: docker:dind

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""    

build-docker:
  stage: RUN_TESTS
  script:
    - echo "Running the tests..."
    - docker build -t run-tests .

This works totally fine with docker:dind image set as the service block as shown above.这完全适用于docker:dind图像集作为service块,如上所示。

Now here comes the fun part, I need some other packages inside the docker:dind image.现在有趣的部分来了,我需要docker:dind图像中的一些其他包。 So I wrote the Dockerfile as below:所以我写了Dockerfile如下:

FROM docker:dind

RUN apk update

ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools

RUN apk add groff
RUN pip3 install awscli
RUN apk --purge -v del py-pip
RUN rm /var/cache/apk/*

So, I built the above image and pushed it into my dockerhub.因此,我构建了上面的图像并将其推送到我的 dockerhub 中。

As of now, everything is cool.到目前为止,一切都很酷。 Image built successfully and pushed successfully.镜像构建成功,推送成功。

And then I changed the services in the .gitlab-ci.yml to my new images as below:然后我将.gitlab-ci.yml中的services更改为我的新图像,如下所示:


services:
  - name: 199508/dind-new:latest

And I ran the pipeline and I get the error below.我运行了管道,我得到了下面的错误。

This error I am getting below is strange:我在下面遇到的这个错误很奇怪:

error during connect: Post http://docker:2375/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=n6fvaaoisom3ny2cfozrlom50&shmsize=0&t=run-tests&target=&ulimits=null&version=1: dial tcp: lookup docker on: no such host连接期间出现错误:发布 http://docker:2375/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&s=%7B%7D 0&memswap=0&networkmode=default&rm=1&session=n6fvaaoisom3ny2cfozrlom50&shmsize=0&t=run-tests&target=&ulimits=null&version=1:拨tcp:查找Z05B6053C41A2130AFD6FC3B15B上没有这样的主机:

The only change I did was installing some applications/dependencies in the above Dockerfile but why it is not working?我所做的唯一更改是在上述Dockerfile中安装一些应用程序/依赖项,但为什么它不起作用? How come when I use docker:dind it is working and when I created a new Dockerfile with the same docker:dind base image and it doesn't work?当我使用docker:dind它正在工作时,当我使用相同的docker:dind基本图像创建一个新的Dockerfile并且它不起作用时,怎么会这样?

Can someone please help me?有人可以帮帮我吗?

Actually I just run into this problem yesterday The main thing is to switch to docker image version In Your case in the Dockerfile not like here其实我昨天刚遇到这个问题主要是切换到docker镜像版本在你的情况下Dockerfile不像这里

FROM docker:18.09

And change the port: The lines commented out are the once the didn't work for me.并更改端口:注释掉的行是曾经对我不起作用的行。

image: 199508/dind-new:v5
services:
  # - docker:19.03.12-dind
  - docker:18.09-dind


variables:
  # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
  DOCKER_HOST: tcp://docker:2375/
  # DOCKER_HOST: tcp://docker:2376
  # DOCKER_TLS_CERTDIR: "/certs"
  DOCKER_TLS_CERTDIR: ""
  CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
  CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
  DOCKER_DRIVER: overlay2

暂无
暂无

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

相关问题 Gitlab Runner Docker 连接期间登录不工作错误:发布 http://docker:2375/v1.40/auth:拨打 tcp:在 67.207.67.3:53 上查找 docker - Gitlab Runner Docker login not working error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53 docker-compose 中的 Gitlab-runner 无法连接 http://docker:2375/v1.40/info - Gitlab-runner in docker-compose cannot connect http://docker:2375/v1.40/info gitlab-runner docker exeuctor (dind) - Error https://docker:2375/v1.40/info dial tcp: lookup docker on - gitlab-runner docker exeuctor (dind) - Error https://docker:2375/v1.40/info dial tcp: lookup docker on 连接时出错:获取 http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: read unix @->/var/run/docker.sock: read: connection reset by peer - error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: read unix @->/var/run/docker.sock: read: connection reset by peer Bamboo:泊坞窗任务“尝试连接时发生错误:发布http://127.0.0.1:2375/v1.22/build” - Bamboo: docker task “An error occurred trying to connect: Post http://127.0.0.1:2375/v1.22/build” Docker API V1.40 如何创建服务并将其连接到 swarm 覆盖网络以与其他堆栈点通信 - Docker API V1.40 how to Create Service And connect it to the swarm overlay network for communication with other stack points Docker API v1.40 获取容器日志 - Docker API v1.40 getting container logs Docker - 连接到端口 2375 时出错 - Docker - error during connect to port 2375 连接期间出现错误:获取 http://docker:2375/v1.24/containers/json:拨打 tcp:查找 Z05B6053C41A2130AFD6FC3B158BDA4E653:服务器上行为不端.23.2 - error during connect: Get http://docker:2375/v1.24/containers/json: dial tcp: lookup docker on 10.0.2.3:53: server misbehaving 错误:无法在 http://0.0.0.0:2375 连接到 Docker 守护程序 - 它正在运行吗? - ERROR: Couldn't connect to Docker daemon at http://0.0.0.0:2375 - is it running?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM