連接期間的 Docker for Desktop 錯誤:發布連接嘗試失敗,因為連接方沒有正確 (Docker for Desktop error during connect: Post A connection attempt failed because the connected party did not properly)


問題描述

連接期間的 Docker for Desktop 錯誤:發布連接嘗試失敗,因為連接方沒有正確 (Docker for Desktop error during connect: Post A connection attempt failed because the connected party did not properly)

我在 Windows 10 Home 中全新安裝了 Docker for Desktop Edge,並嘗試使用 docker build 命令構建映像。但不幸的是,它對我不起作用,並出現以下錯誤:

CMD ‑ docker build ‑t heet1996/post:0.0.1 .

error during connect: Post https://192.168.99.100:2376/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=na8ugnpn6d8gnxl3z8ppx4gap&shmsize=0&t=heet1996%2Fpost%3A0.0.1&target=&ulimits=null&version=1: dial tcp 192.168.99.100:2376: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

enter image description here

之前我使用的是 docker 工具箱,所以在安裝 Docker 之前,我必須在我的用戶變量中刪除所有與 Docker 相關的環境變量用於桌面。在 GitHub 問題上進行了大量搜索後,我仍然沒有得到解決方案。

這是我在 service.txt 文件中找到的 (C:\ProgramData\DockerDesktop\service.txt)

[18:27:22.232][LoggingMessageHandler][Info] [f9b6b957] <;服務器端> POST http://localhost/dns/refresh‑hosts ‑> 204 NoContent(耗時 118 毫秒)


參考解法

方法 1:

I got this error when i un‑installed the docker toolbox and installed the docker desktop.

System Configuration: OS: Windows 10 Home Version: 21H1

Steps I Followed:

  1. Un‑installed the docker desktop.
  2. Removed the all dockers related environment variables from the user variables. Navigation: This System‑> Properties‑> Advance System Settings‑> Environment Variables‑> User Variables.
  3. Re‑installed the docker desktop and it's started working properly.

方法 2:

Try to run it on Docker CLI instead of CMD

方法 3:

Docker for windows must have:

  • [✓] Updated Windows 10 version >=2004
  • [✓] WSL 2 and Default Distro (i.e ubuntu)

The steps are well documented here. These are what to do after the installation:

  1. To confirm ubuntu's installation, open C:/Windows/System32/bash.exe aka bash.
  2. To test if docker is properly installed, run docker version on bash. This should print the docker client and server engine.
  3. After successfully tested and confirmed the installations, try entering your command
$ docker build ‑t heet1996/post:0.0.1 .

方法 4:

Open Powershell as Administrator and run the below commands

cd "C:\Program Files\Docker\Docker"

./DockerCli.exe ‑SwitchDaemon

方法 5:

here we are talking about using Docker with PowerShell and not with WSL. And also following the addition of variables in the environment variables of Windows.

Configuration when this response was made:

  • Windows 10 Pro 20H2 (Build 19042.867)
  • Docker 20.10.5
  • Powershell 5.1.19041.610

I also had to configure docker in a dirty way too much, after several hours of research and a comparison of installation on a clean Windows 10 I understood where my error was.

In addition to the user environment variable also make sure that you do not have DOCKER variables in the Windows system environment variables either.

Here is where my error was, I think it was due to the installation of the Docker module

enter image description here

I had the DOCKER_HOST variable in my system variable environment, so i deleted it.

If you want to check all your environment variables with Powershell:

[System.Environment]::GetEnvironmentVariables()

If you really want a Docker fresh installation on Windows, you need to delete the following folders:

C:\ProgramData\Docker
C:\Program Files\Docker\Docker
$HOME\AppData\Local\Docker
$HOME\AppData\Roaming\Docker
$HOME\AppData\Roaming\Docker Desktop
$HOME\.docker

my error, therefore, produced this error:

ERROR ==> error during connect: Get http://docker.artofshell:2376/v1.24/version: dial tcp: lookup docker.artofshell: no such host

enter image description here

After a complete uninstall of all docker (Via chocolatey, official docker ...) and by properly installing Docker from the official executable here everything is back to normal

Then if you want to use docker via Powershell you have to change the configuration of DockerCLI as you can see on many answers

enter image description here


Conclusion

  • It is possible to use docker with Powershell you must check if the server daemon is used by Windows/amd64, you can modify the daemon with this command cd "C:\Program Files\Docker\Docker"; .\DockerCli.exe ‑SwitchDeamon
  • You can check the configuration of the daemon with the following command: docker version
  • You must remove all traces of old Docker installations if you had any
  • You must delete the environment variables from the old installation or from the docker toolbox
  • You must also activate the experimental features: information here

(by Heet ShahPrashant KadamBAILLAHI Leminego je joAshokLinkPhoenix)

參考文件

  1. Docker for Desktop error during connect: Post A connection attempt failed because the connected party did not properly (CC BY‑SA 2.5/3.0/4.0)

#docker-desktop #docker #Windows






相關問題

在 Docker 容器中安裝 Windows 服務 (Install Windows service in Docker container)

在不同的用戶下啟動 docker 容器 (Start the docker container under a different user)

如何在 Docker Desktop 上創建新的 Kubernetes 集群? (How to create a new Kubernetes cluster on Docker Desktop?)

連接期間的 Docker for Desktop 錯誤:發布連接嘗試失敗,因為連接方沒有正確 (Docker for Desktop error during connect: Post A connection attempt failed because the connected party did not properly)

Jenkins 昨天安裝成功並在 windows 10 的 docker 桌面上運行,但今天無法在 http://localhost:8080 啟動 jenkins (Jenkins installed successfully and run on docker desktop on windows 10 yesterday , but unable to start jenkins at http://localhost:8080 today)

運行“docker exec”時發布端口 (publish port when running 'docker exec')

無法連接到 docker-desktop kubernetes 中部署的 API?負載均衡器服務不工作 (Unable to connect to the API deployed in docker-desktop kubernetes?. Loadbalancer service not working)

我在哪裡可以看到失敗的 Docker Desktop Windows 安裝的日誌文件? (Where can I see log files for failed Docker Desktop Windows installation?)

如何從 docker-credential-osxkeychain 獲取價值 (How to get value from docker-credential-osxkeychain)

無法訪問 Kubernetes 集群外的 NodePort 服務 (Cannot access NodePort service outside Kubernetes cluster)

如何在 eclipse-che 環境中配置 docker 引擎 (How to configure docker engine inside eclipse-che environment)

如何在 Docker Desktop 中使用參數運行 docker 實例? (How to run a docker instance with params in Docker Desktop?)







留言討論