1 Star 0 Fork 58

gnaygnil/docker

forked from src-openEuler/docker 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0046-debug-add-more-error-info-when-dial-docker.so.patch 1.84 KB
一键复制 编辑 原始数据 按行查看 历史
gnaygnil 提交于 2020-02-13 15:36 . docker: Fixed build error and URL
From 024a67b1d7ccfa85bba14318cd4fbbe78ecc8b7e Mon Sep 17 00:00:00 2001
From: jingrui <jingrui@huawei.com>
Date: Thu, 10 Jan 2019 00:17:01 +0800
Subject: [PATCH 046/111] debug: add more error info when dial
docker.sock fail
reason: cherry-pick commits to docker-18.09
add more error info when dial docker.sock fail
cherry-pick from 1.11.2: 91c7491
Change-Id: I3c7219d44be752ecde92479f03c0e2cee3ccb4a0
Signed-off-by: lujingxiao <lujingxiao@huawei.com>
Signed-off-by: xiadanni <xiadanni@huawei.com>
---
components/engine/client/request.go | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/components/engine/client/request.go b/components/engine/client/request.go
index a19d62aa52..855b84d6ac 100644
--- a/components/engine/client/request.go
+++ b/components/engine/client/request.go
@@ -10,6 +10,7 @@ import (
"net"
"net/http"
"net/url"
+ "regexp"
"os"
"strings"
@@ -156,11 +157,19 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
if err, ok := err.(net.Error); ok {
if err.Timeout() {
- return serverResp, ErrorConnectionFailed(cli.host)
+ return serverResp, fmt.Errorf("Cannot connect to the Docker daemon failed for timeout.")
}
if !err.Temporary() {
- if strings.Contains(err.Error(), "connection refused") || strings.Contains(err.Error(), "dial unix") {
- return serverResp, ErrorConnectionFailed(cli.host)
+ if strings.Contains(err.Error(), "dial unix") {
+ var err2 error
+ r, rerr := regexp.Compile("dial unix.*")
+ if rerr != nil {
+ err2 = fmt.Errorf("Cannot connect to the Docker daemon failed for dial unix.")
+ } else {
+ rbytes := r.Find([]byte(err.Error()))
+ err2 = fmt.Errorf("Cannot connect to the Docker daemon failed for %s", string(rbytes))
+ }
+ return serverResp, err2
}
}
}
--
2.17.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gnaygnil/docker.git
git@gitee.com:gnaygnil/docker.git
gnaygnil
docker
docker
master

搜索帮助