1.在docker desktop中的setting中,打开
“Expose daemon on tcp://localhost:2375 without TLS
Exposing daemon on TCP without TLS helps legacy clients connect to the daemon. It also makes yourself vulnerable to remote code execution attacks. Use with caution. ”
2.在IDE中,打开docker服务,在连接的时候,选择"TCP socket",“Engine API URL”设置为:
tcp://localhost:2375,这个是需要和之前第一步中的内容对应。
然后就连接成功了。