Docker-Compose停止在Debian 11上安装Docker Desktop工作
我在Debian 11 Machine上安装了Linux的Docker桌面。
安装后,我无法使用Docker-Compose或Laravel帆。 错误是:
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
未设置docker_host env变量。
Docker CLI仍在正常工作。
有人可以帮我吗? 提前致谢
I installed Docker Desktop for Linux on my Debian 11 machine.
After the installation, I'm not able to use docker-compose or laravel sail.
The error is:
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
The DOCKER_HOST env variable is not set.
The docker CLI is still working properly.
Someone can help me?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑:
最快,最清洁的方式:
检查“启用Docker在Docker桌面设置的常规部分中构成V1/V2兼容模式” 。
tldr:
运行命令
docker上下文ls
发现新主机。复制 docker端点对应于 desktop-linux 上下文
export docker_host = {您的docker endpoint}
(这仅适用于当前终端会话,您将在System Reboot上丢失配置)<强>长答案和解释:
linux上的 docker桌面 在虚拟机上运行,并使用 docker compose v2 而不是
docker-compose (使用它的命令是
docker组成的
没有连字符)。为了避免它在本地计算机上掩盖Docker Engrion服务,并创建一个新的上下文。
由于已经掩盖了本地 docker 服务,因此它不再在您的本地计算机上运行。
上下文可以切换到默认一个,如果您想使用docker引擎而不是Docker桌面。这样,您当地的码头组合将像以前一样工作。
另一种方法是将本地docker-compose 连接到新虚拟机上的 docker桌面主机。
这可以通过两种方式完成:
docker-compose -h {docker endpoint}命令
EDIT:
Fastest and cleaner way:
Check "Enable Docker Compose V1/V2 compatibility mode" in the General section of the Docker Desktop settings.
TLDR:
Run the command
docker context ls
to discover the new host.Copy the DOCKER ENDPOINT corresponding to the desktop-Linux context
Set the DOCKER_HOST environment variable by choosing one of those two methods:
export DOCKER_HOST={your docker endpoint}
(this is valid only for the current terminal session and you will lose the config on system reboot)Long answer and explanation:
The Docker Desktop on Linux runs on a virtual machine and uses docker compose V2 instead of
docker-compose
(the command to use it isdocker compose
without the hyphen).To avoid it masks the docker engine service on the local machine and creates a new context.
As the local Docker service has been masked, it is not running anymore on your local machine.
The context can be switched to the default one if you want to use Docker Engine instead of Docker Desktop. That way your local docker-compose will work as before.
Another way is to connect the local docker-compose to the Docker Desktop host on the new virtual machine.
This can be done in two ways:
docker-compose -H {your docker endpoint} COMMAND
Docker上下文LS
给输出
它将起作用
docker context ls
give output
it will work