首页 > 解决方案 > docker-machine 节点无法连接到管理器

问题描述

我的 Windows 上安装了 Docker for Desktop。我用 docker-machine 创建了一个节点,当尝试将此节点连接到管理器时,我收到一个错误:

Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

我的输出docker version

Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:14:53 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

我的输出docker 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)
  scan: Docker Scan (Docker Inc., v0.6.0)

Server:
 Containers: 14
  Running: 0
  Paused: 0
  Stopped: 14
 Images: 19
 Server Version: 20.10.5
 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: active
  NodeID: g09ay2dnys6u5wtq3lbzzg90y
  Is Manager: true
  ClusterID: kk1niv8ck4zodlt7yh68p4rl6
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.65.3
  Manager Addresses:
   192.168.65.3:2377
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 2.92GiB
 Name: docker-desktop
 ID: R3TI:W7P7:M5FG:CU2H:ZWEE:B2IH:6CCO:4AOK:UG2C:BFNS:LR7I:VMSN
 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 throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

使用命令创建虚拟节点docker-machine create --driver vmware node1。节点创建成功。当我运行docker-machine ls命令时,我可以看到节点:

NAME    ACTIVE   DRIVER   STATE     URL                         SWARM   DOCKER      ERRORS
node1   -        vmware   Running   tcp://192.168.84.128:2376           v19.03.12

我使用登录到 node1 docker-machine ssh node1,当我尝试node1使用命令将其连接到管理器时docker swarm join --token SWMTKN-1-35n4bvnfkl5lsau9n7nywdnpo8lwb1i3eszcjxsr8npdxas67d-bi52b4gpojjcu37s5jzdxpfh0 192.168.65.3:2377,我收到了上述错误:

Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

我看到一些提到日期时间差异的解决方案,连接到 ntp 服务器可以解决这个问题。我不知道该怎么做。一些提到的端口在节点上打开或未打开,并且所有必要的端口都打开了,但仍然无法正常工作。有人可以帮我解决这个问题吗?

标签: dockerdocker-machine

解决方案


推荐阅读