如何将IntelliJ的Docker插件连接到Docker Desktop Windows

问题描述 投票:0回答:1

我正在运行最新的Windows 10 Pro版本(1903),最新的Docker Engine版本(v19.03.8)和最新的IntelliJ(2019.3.4)。我已设置不带TLS的tcp://localhost:2375上的公开守护进程并应用/重新启动引擎。尝试切换到Windows容器似乎挂了守护程序,并引发错误,此后,我需要销毁所有设置和配置文件,然后才能再次启动守护程序。

但是,当我尝试在Docker插件中设置tcp://localhost:2375时,连接只是失败了(可能是超时,但是没有日志)。但是,只需使用CLI中的docker info和其他命令即可按预期工作,因此我可以肯定Engine正在运行。供参考,docker info的输出:

$ docker system info
Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0)
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.943GiB
 Name: docker-desktop
 ID: NGP3:BQCE:JSUO:6BSV:IUU6:2UEZ:4QTQ:N6IO:TA3T:A7I7:4GXS:IYD6
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 34
  Goroutines: 50
  System Time: 2020-03-27T15:56:23.690394533Z
  EventsListeners: 3
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

[我还能尝试什么(除了再次使用Docker Toolkit之外)来启动并运行集成?我什至如何测试连接可能断开的位置?

docker intellij-idea windows-10
1个回答
0
投票

所以经过三天的研究,我得到了答案。显然,Windows 10保留了2344-2444的端口范围,这可以防止Docker守护进程actually暴露TCP套接字,尽管进行了设置。我感觉到它也与守护程序在重新启动后无法启动有关。您可以通过在提升的提示符/ powershell中执行以下操作来验证是否是问题的根本原因:netsh interface ipv4 show excludedportrange protocol=tcp-如果输出显示的范围包括2375,则您受此影响,修复(这将包括两次重新启动!):

    禁用HyperV并重新启动,以释放端口分配:dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
  1. 手动分配端口2375:netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1
  2. 重新启用HyperV并重新启动以利用此修复程序:dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
  3. 可选:在此过程之后,您可以在该套接字上重新启用TLS,并且Docker插件将可以正常连接。
© www.soinside.com 2019 - 2024. All rights reserved.