gpt4 book ai didi

linux - docker (撰写): connection refused without sudo

转载 作者:行者123 更新时间:2023-12-04 18:39:06 25 4
gpt4 key购买 nike

一切都很好,直到“某事”。在那个“东西”之后,我可以使用 dockerdocker-composesudo但没有它 docker将无限期挂起,docker-compose将返回连接堆栈跟踪。
不起作用:

  • 运行docker没有 sudo 会无限期地挂起。通过导出 DOCKER_HOST=tcp://127.0.0.1:2375 暂时修复.
  • docker-compose没有 sudo 返回 connection refused .这不是连接到特定容器,而是连接到所有基本命令,例如 docker-compose ps .

  • 用户属于 docker 的证明团体:
    kretyn@junk$ groups kretyn
    kretyn : kretyn adm cdrom sudo dip plugdev lpadmin lxd sambashare docker
    解决方案提示
    我激活了一个指向现有但非事件主机的 docker 上下文。删除该上下文并取消设置 DOCKER_HOST允许 docker命令才能正常工作。这是一个惊喜,因为我在写这个问题之前重新安装(清除了我能找到的所有东西)docker。
    删除上下文是不够的。 Docker Compose 需要显式 docker context use default否则它不会明白的。 docker-compose ps 的问题仍然存在。 docker-compose 上的堆栈跟踪
    kretyn@junk$ docker-compose ps
    Traceback (most recent call last):
    File "urllib3/connection.py", line 159, in _new_conn
    File "urllib3/util/connection.py", line 84, in create_connection
    File "urllib3/util/connection.py", line 74, in create_connection
    ConnectionRefusedError: [Errno 111] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "urllib3/connectionpool.py", line 670, in urlopen
    File "urllib3/connectionpool.py", line 392, in _make_request
    File "http/client.py", line 1255, in request
    File "http/client.py", line 1301, in _send_request
    File "http/client.py", line 1250, in endheaders
    File "http/client.py", line 1010, in _send_output
    File "http/client.py", line 950, in send
    File "urllib3/connection.py", line 187, in connect
    File "urllib3/connection.py", line 171, in _new_conn
    urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f762c4e3e20>: Failed to establish a new connection: [Errno 111] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "requests/adapters.py", line 439, in send
    File "urllib3/connectionpool.py", line 726, in urlopen
    File "urllib3/util/retry.py", line 446, in increment
    urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=2375): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f762c4e3e20>: Failed to establish a new connection: [Errno 111] Connection refused'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "docker/api/client.py", line 214, in _retrieve_server_version
    File "docker/api/daemon.py", line 181, in version
    File "docker/utils/decorators.py", line 46, in inner
    File "docker/api/client.py", line 237, in _get
    File "requests/sessions.py", line 543, in get
    File "requests/sessions.py", line 530, in request
    File "requests/sessions.py", line 643, in send
    File "requests/adapters.py", line 516, in send
    requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=2375): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f762c4e3e20>: Failed to establish a new connection: [Errno 111] Connection refused'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "docker-compose", line 3, in <module>
    File "compose/cli/main.py", line 80, in main
    File "compose/cli/main.py", line 189, in perform_command
    File "compose/cli/command.py", line 60, in project_from_options
    File "compose/cli/command.py", line 152, in get_project
    File "compose/cli/docker_client.py", line 41, in get_client
    File "compose/cli/docker_client.py", line 170, in docker_client
    File "docker/api/client.py", line 197, in __init__
    File "docker/api/client.py", line 221, in _retrieve_server_version
    docker.errors.DockerException: Error while fetching server API version: HTTPConnectionPool(host='127.0.0.1', port=2375): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f762c4e3e20>: Failed to establish a new connection: [Errno 111] Connection refused'))
    [46145] Failed to execute script docker-compose
    版本/构建
    Linux 发行版
    kretyn@junk$ uname -a
    Linux junk 5.8.0-43-generic #49~20.04.1-Ubuntu SMP Fri Feb 5 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
    docker
    kretyn@junk$ sudo docker system info
    Client:
    Context: default
    Debug Mode: false
    Plugins:
    app: Docker App (Docker Inc., v0.9.1-beta3)
    buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

    Server:
    Containers: 9
    Running: 8
    Paused: 0
    Stopped: 1
    Images: 44
    Server Version: 20.10.3
    Storage Driver: overlay2
    Backing Filesystem: extfs
    Supports d_type: true
    Native Overlay Diff: true
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
    Cgroup Version: 1
    Plugins:
    Volume: local
    Network: bridge host ipvlan macvlan null overlay
    Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
    Swarm: inactive
    Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
    Default Runtime: runc
    Init Binary: docker-init
    containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
    runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
    init version: de40ad0
    Security Options:
    apparmor
    seccomp
    Profile: default
    Kernel Version: 5.8.0-43-generic
    Operating System: Ubuntu 20.04.2 LTS
    OSType: linux
    Architecture: x86_64
    CPUs: 12
    Total Memory: 15.29GiB
    Name: meland
    ID: 3PE6:4AWU:LGRR:HOBJ:XUCJ:ER4H:ZEF5:MWUJ:COEG:WPK5:YH2U:FKUF
    Docker Root Dir: /var/lib/docker
    Debug Mode: false
    Registry: https://index.docker.io/v1/
    Labels:
    Experimental: false
    Insecure Registries:
    127.0.0.0/8
    Live Restore Enabled: false

    WARNING: No blkio weight support
    WARNING: No blkio weight_device support
    docker 组成
    kretyn@junk$ sudo docker-compose version
    docker-compose version 1.28.0, build d02a7b1a
    docker-py version: 4.4.1
    CPython version: 3.9.0
    OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019

    最佳答案

    问题是死了context入口。
    解决方案
    删除了名为 remote 的死上下文使用 docker context rm remote .
    即使 docker context ls指向default默认情况下,必须执行 docker context use default以便正确更新上下文。
    作为部分修复,我之前设置了 DOCKER_HOSTtcp://127.0.0.1:2375 .更新上下文后,必须取消设置 env 变量,即 unset DOCKER_HOST .
    惰性命令,假设上下文 remote :

    $ docker context rm remote
    $ docker context use default
    $ unset DOCKER_HOST
    背景
    有一个 remote基于 ssh 端点的上下文。我的 ssh 配置设置为名称指向我的域,但最近删除了它背后的主机。
    有趣的是,我已经“修复”了一段时间,其中一个步骤是从我的本地 Ubuntu 主机中彻底清除 docker,包括 apt , /var/lib/docker , /etc/docker~/.local/ 中的随机脚本. context ,然而,没有被清理。

    关于linux - docker (撰写): connection refused without sudo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66250005/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com