当前位置: 首页 > 知识库问答 >
问题:

Centos7上的Docker:连接拒绝

扈阳辉
2023-03-14

我知道在类似问题上已经发布了一些问题,但不幸的是,我仍然无法使以下命令正常工作:

$sudo docker run hello world

无法在本地找到映像“hello world:latest”:docker:来自守护程序的错误响应:Gethttps://registry-1.docker.io/v2/: 拨打tcp 52.54.216.153:443:getsockopt:连接被拒绝。请参阅“docker run--帮助”。

我在VirtualBox上使用CentOS7虚拟机,在系统级别配置了HTTP/HTTPS/FTP代理设置。此代理配置一直适用于Chrome和其他应用程序。

浏览此论坛后,我试图通过以下方式为Docker应用程序创建显式代理设置:

>

创建/etc/systemd/system/docker.service.d/http-proxy.conf,然后执行“systemctl守护程序重新加载”和“systemctl重新启动docker”

以下是我的虚拟机上Docker的版本:

docker版本

Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:20:16 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:23:58 2018
  OS/Arch:      linux/amd64
  Experimental: false

$curl-vhttps://registry-1.docker.io/v2/

* About to connect() to proxy XXX port 8012 (#0)
...
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*   subject: CN=*.docker.io
*   start date: Aug 02 00:00:00 2017 GMT
*   expire date: Sep 02 12:00:00 2018 GMT
*   common name: *.docker.io
*   issuer: CN=Amazon,OU=Server CA 1B,O=Amazon,C=US
> GET /v2/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: registry-1.docker.io
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=utf-8
< Docker-Distribution-Api-Version: registry/2.0
< Www-Authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io"
< Date: Fri, 08 Jun 2018 16:00:17 GMT
< Content-Length: 87
< Strict-Transport-Security: max-age=31536000
< 
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
* Connection #0 to host XXX left intact

$curl-vhttps://54.152.209.167

   ...
   ...
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* Server certificate:
*   subject: CN=*.docker.io
*   start date: Aug 02 00:00:00 2017 GMT
*   expire date: Sep 02 12:00:00 2018 GMT
*   common name: *.docker.io
*   issuer: CN=Amazon,OU=Server CA 1B,O=Amazon,C=US
* NSS error -12276 (SSL_ERROR_BAD_CERT_DOMAIN)
* Unable to communicate securely with peer: requested domain name does not match the server's certificate.
* Closing connection 0
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.

共有1个答案

甄云
2023-03-14

如https://docs.docker.com/config/daemon/systemd/#httphttps-proxy所述,以下命令解决了我的问题。在医生那里有点迷失了,IMO。

$ sudo mkdir -p /etc/systemd/system/docker.service.d

vi /etc/systemd/system/docker.service.d/http-proxy.conf 
[Service]
Environment="http://IP:PORT/"

vi /etc/systemd/system/docker.service.d/https-proxy.conf 
[Service]
Environment="http://IP:PORT/"

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://"http://IP:PORT/"
 类似资料:
  • 问题内容: 我正在尝试通过代码访问Redis服务器,但未连接。但是,如果我猛击redis容器,我可以访问redis-cli。 docker-compose.yml看起来像这样 Dockerfile_redis 当我尝试使用此代码连接到Redis服务器时 它发出此警告 有谁知道如何将Redis容器连接到PHP容器? 问题答案: 你的问题 Docker Compose 为不同的服务创建了单独的dock

  • 我已经确认Alpine/Socat正在http://127.0.0.1:2376上运行/可能是守护进程未连接的问题,请提供帮助。使用OSX的TIA 连接被拒绝:/127.0.0.1:2376 java.net.connectException:连接被拒绝导致:io.netty.channel.abstractChannel$annotatedConnectException:连接被拒绝:/127.

  • 问题内容: 我正在尝试使用DockerCompose使用远程存储库部署ConfigServrService和客户端。 docker-compose.yml类似于: 在他们部署的那一刻,客户端控制台显示: cccConfigServicePropertySourceLocator:从位于http:// localhost:8888的 服务器中获取配置 (而不是http:// config-serve

  • postgres-db 2021-02-23 22:46:3.410 UTC[1]日志:数据库系统已准备好接受连接 .环境: Docker-compose: 日志: app_1 22:46:31.020[error]GenServer#PID<0.368.0>终止app_1**(dbconnection.connectionerror)tcp连接(postgres-DB:5433):连接拒绝-:e

  • 我有以下设置: 此外,在node.js进程stdout/stderr中没有错误或崩溃的迹象。 以下是我看到的错误: 会有什么问题?

  • 试图在localhost中建立从app容器到mysql容器的连接,出现连接拒绝异常 我们正在采取一种docker的方法来调用rest api服务来采用微服务的方法。我们正在建立应用程序容器和mysql容器之间的连接,同时我们编写了一个docker-compose文件,创建了mysql容器和应用程序容器,为这两个容器公开了端口。下面是运行docker-compose文件docker-compose