无法连接到Docker守护程序WINDOWS

问题描述

我已经为WINDOWS 10安装了稳定的Docker桌面。我尝试运行:

docker run hello-world
    Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message,Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client,which sent it
    to your terminal.

因此,它似乎可以连接到Docker守护程序。但是,当我运行自己的命令时:

C:\Users\cortex>bash
DESKTOP-2GHN95P:/tmp/docker-desktop-root/mnt/host/c/Users/cortex/# cortex deploy

我收到以下错误

error: unable to connect to the Docker daemon

please confirm Docker is running,or if Docker is not installed,install it by following the instructions for your operating system: https://docs.docker.com/install

我是Docker的新手,我无法弄清楚这个问题。有任何想法吗?

解决方法

看起来您正在尝试从WSL运行皮质,WSL正在尝试对主机OS中的docker引擎执行操作。如果您具有WSL 2,则可以在设置中为Docker桌面启用WSL 2集成。如果这不是一种选择,那么您始终可以在WSL上始终安装docker,