由于错误无法在 Ubuntu WSL 上运行 Docker 无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程.docker 守护进程是否正在运行?

编程入门 行业动态 更新时间:2024-10-24 10:24:27
本文介绍了由于错误无法在 Ubuntu WSL 上运行 Docker 无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程.docker 守护进程是否正在运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我在 Windows 10 机器上运行 WSL 2 (Ubuntu).我使用官方 Docker 指南 (

...从默认 WSL2 访问

基于这篇文章.Linux 开发人员使用 WSL 2、Docker 桌面的 Windows 环境和 docker 文档.Docker 桌面 WSL 2 后端

以下仅适用于 WSL1

docker 似乎无法在 WSL 中运行.他们建议将 WSL 连接到在 Windows 中运行的 docker 桌面:为 Windows 和 WSL 设置 Docker

在 docker 论坛中,他们也提到了该解决方案:无法连接到 docker 守护进程

希望有所帮助.

I am running WSL 2 (Ubuntu) on a Windows 10 machine. I installed Docker on my Ubuntu using the official Docker guide (https://docs.docker/engine/install/ubuntu/#install-using-the-repository). Running docker run hello-world produces the following error: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

I have tried the following steps:

Using sudo docker... instead of docker... Adding user to docker usergroup with sudo usermod -aG docker $(whoami) sudo nohup docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock & which I found in this thread: https://forums.docker/t/cannot-connect-to-the-docker-daemon-is-the-docker-daemon-running-on-this-host/8925/4

None of these steps helped.

docker version produces this output:

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

service docker status gives Docker is not running. service docker start/restart does nothing, Docker does not start. Any ideas what could be the issue?

解决方案

I found your question, as I was trying to achieve the same. {I have updated my question as with the latest windows update, the process it's much more easier}

Using WSL2

You simply have to activate and use WSL2, I have to install Ubuntu 20.04 as the 18.04 wasn't connecting with Docker desktop. In the windows shell:

To check the WSL mode, run

wsl -l -v

To upgrade your existing Linux distro to v2, run:

wsl --set-version (distro name) 2

WSL Integration will be enabled on your default WSL distribution. To change your default WSL distro, run

wsl --set-default <distro name>

Then in docker you have to.

...use the WSL2 engine

...access from your default WSL2

Based on this article. A Linux Dev Environment on Windows with WSL 2, Docker Desktop And the docker docs. Docker Desktop WSL 2 backend

Below is valid only for WSL1

It seems that docker cannot run inside WSL. What they propose is to connect the WSL to your docker desktop running in windows: Setting Up Docker for Windows and WSL

In the docker forums they also refer to that solution: Cannot connect to the docker daemon

Hope that helps.

这篇关于由于错误无法在 Ubuntu WSL 上运行 Docker 无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程.docker 守护进程是否正在运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 08:12:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186738.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   连接到   正在运行   错误   WSL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!