GVKun编程网logo

Docker是在WSL中运行还是连接回Windows?(docker wsl2)

20

想了解Docker是在WSL中运行还是连接回Windows?的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于dockerwsl2的相关问题,此外,我们还将为您介绍关于.net–Windows

想了解Docker是在WSL中运行还是连接回Windows?的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于docker wsl2的相关问题,此外,我们还将为您介绍关于.net – Windows AZURE:类库:如何知道是在Web角色中运行还是在常规Web服务中运行、Docker for Windows和Docker在Windows上有什么区别?、Docker 在 Windows WSL 上的 Ubuntu 中运行、Docker 学习笔记(2):在 Windows10 虚拟机中运行 Docker的新知识。

本文目录一览:

Docker是在WSL中运行还是连接回Windows?(docker wsl2)

Docker是在WSL中运行还是连接回Windows?(docker wsl2)

在WSL中成功安装Docker之后,如果我运行标准Docker命令,则会出现连接错误。在所有示例中,使用sudo或不使用sudo运行都会产生相同的结果。

root@SUR002731165154:~# sudo docker infoCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?root@SUR002731165154:~# sudo docker versionClient:Version:      1.13.1API version:  1.26Go version:   go1.7.5Git commit:   092cba3Built:        Wed Feb  8 06:42:29 2017OS/Arch:      linux/amd64Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

但是,如果我在命令中添加-H localhost:2375,那么我可以运行Docker没问题。Docker是连接到我的本地主机Windows
10计算机还是在WSL上本地运行,还是两者兼而有之?

root@SUR002731165154:~# docker -H localhost:2375 versionClient:Version:      1.13.1API version:  1.26Go version:   go1.7.5Git commit:   092cba3Built:        Wed Feb  8 06:42:29 2017OS/Arch:      linux/amd64Server:Version:      1.13.1API version:  1.26 (minimum version 1.12)Go version:   go1.7.5Git commit:   092cba3Built:        Wed Feb  8 08:47:51 2017OS/Arch:      linux/amd64Experimental: trueroot@SUR002731165154:~# docker -H localhost:2375 infoContainers: 11Running: 0Paused: 0Stopped: 11Images: 8Server Version: 1.13.1Storage Driver: overlay2Backing Filesystem: extfsSupports d_type: trueNative Overlay Diff: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins:Volume: localNetwork: bridge host ipvlan macvlan null overlaySwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1runc version: 9df8b306d01f59d3a8029be411de015b7304dd8finit version: 949e6faSecurity Options:seccompProfile: defaultKernel Version: 4.9.8-mobyOperating System: Alpine Linux v3.5OSType: linuxArchitecture: x86_64CPUs: 2Total Memory: 1.934 GiBName: mobyID: 4LYM:R5T5:6CPZ:Z2KC:YQ4R:NGN4:V6SR:DF7E:YPYO:7FHY:EQW5:2T7WDocker Root Dir: /var/lib/dockerDebug Mode (client): falseDebug Mode (server): trueFile Descriptors: 13Goroutines: 21System Time: 2017-02-28T18:54:13.7726687ZEventsListeners: 0Registry: https://index.docker.io/v1/Experimental: trueInsecure Registries:127.0.0.0/8Live Restore Enabled: false

答案1

小编典典

Docker守护程序无法实现必要的内核ABI,因此无法在WSL下运行。如果您正在运行Windows的Docker,则可能正在连接到它管理的Hyper-
V虚拟机。

因为它在另一台机器上,所以您将无法将WSL目录作为Docker卷挂载,但是可以从WSL目录构建映像。这是因为在构建中,客户端会创建一个tarball并将其发送到守护程序。

.net – Windows AZURE:类库:如何知道是在Web角色中运行还是在常规Web服务中运行

.net – Windows AZURE:类库:如何知道是在Web角色中运行还是在常规Web服务中运行

我有一个类库,有时由Webrole服务引用,有时由内部服务器上的IIS中运行的常规WCF服务引用. (它是一个包含util函数的内部框架类库)

在该类库中是否有一种方法可以检测它当前是在Windows AZURE环境中运行还是在IIS中运行?

解决方法

我们使用一个静态类,其中包含一些使用Microsoft.WindowsAzure.ServiceRuntime的RoleEnvironment的属性:

public static bool InAzureEnvironment
    {
        get
        {
            return RoleEnvironment.IsAvailable;
        }
    }

    public static bool InCloud
    {
        get
        {
            return InAzureEnvironment && !RoleEnvironment.IsEmulated;
        }
    }

哪个工作得很好.

Docker for Windows和Docker在Windows上有什么区别?

Docker for Windows和Docker在Windows上有什么区别?

Windows上的Docker似乎是Windows Server 2016内置的东西? 并支持在Docker容器中运行Windows,并使用Windows作为Docker容器主机。 这是否支持Linux? 我不这么认为,我认为它只支持运行Windows Docker容器。 这似乎也是由Microsoft维护的。

Docker for Windows似乎是由Docker团队创build的一个独立安装,用于将Linux Docker引入Windows。 所以Windows可以是Docker主机,但所有的容器仍然只是普通的Linux容器。 这是否支持Windows容器? 我不这么认为,我认为它只支持运行Linux Docker容器。 这似乎也是由Docker维护的。

另一个值得注意的事情是, 用于Visual Studio的Docker Tools似乎只支持Docker for Windows,而不支持Windows上的Docker。

我真正想要的是两者之间的差异,这是一个很好的比较。 每个人都有什么特点,他们在哪里相似,他们在哪里有所不同。 他们会不一样,还是会一起来?

运行groovy时windows CMD的怪异行为

发送stdout文件没有发球

C ++ Windows32 GDI填充三angular形

通过Windows控制台使用Docker:包含本地卷名称的无效字符

我如何重命名DOS下当前目录下的所有隐藏目录?

RegEx取代RegEx

使用c#在远程Windows服务器上创build本地用户

启动mongod.exe / mongo.exe时出错0xc000007b

更新Ruby 1.9.3 – > 2.0.0而不会丢失gem

在Windows 7上将软件包安装到虚拟环境中

Windows上的Docker是一种通俗的方式来引用在Windows上运行的Docker引擎 。 我觉得这有助于将其视为Windows容器主机 ,所以是Windows容器 。 这将是你将在Windows server 2016机器上运行的。 所以也许更好的名字是Docker for Windows server ,我相信人们也用它。 我仍然喜欢Windows容器主机。 这意味着它在一天结束时只有Docker引擎,甚至不需要任何Docker客户端(docker CLI,docker-compose等)。

用于Windows的Docker是用于在Windows上运行Linux和Windows容器的产品。 这不是为了生产环境 ,而是用于Windows的桌面/客户端SKU,因此是Windows 10的要求。 所以你可以把它看作是Docker for Windows 10.因为DfW可以运行两种容器类型,所以它们在你的机器上设置的配置有所不同:

当使用Linux Containers时,DfW会创建一个Hyper-V的MobyLinuxVM,它内部运行Linux容器,透明,就像在Windows 10主机上运行一样。

使用Windows容器时,DfW将在Windows上安装与Docker相同的组件,以便拥有Windows容器主机。 您现在已经安装了Windows Docker Engine安装程序。 这样,您就可以在Win 10客户端SKU上运行Windows容器。

理论上你可以在Windows server上安装DfW,我还没有试过,所以我不知道这是否会失败,但为什么要在生产中的Windows主机上运行Linux容器? 在生产中,您将拥有运行Linux容器的Linux容器主机和运行Windows容器的Windows容器主机,这样可以避免开销并简化操作。

Docker 在 Windows WSL 上的 Ubuntu 中运行

Docker 在 Windows WSL 上的 Ubuntu 中运行

如何解决Docker 在 Windows WSL 上的 Ubuntu 中运行?

enter image description here

enter image description here

我的错误

donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 114 kB in 4s (26.4 kB/s)
Reading package lists... Done
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/docker.list:1
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns
0 upgraded,7 newly installed,0 to remove and 45 not upgraded.
Need to get 104 MB of archives.
After this operation,448 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://download.docker.com/linux/ubuntu focal/stable amd64 containerd.io amd64 1.4.8-1 [24.7 MB]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 pigz amd64 2.4-1 [57.4 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/universe amd64 slirp4netns amd64 0.4.3-1 [74.3 kB]
Get:4 https://download.docker.com/linux/ubuntu focal/stable amd64 docker-ce-cli amd64 5:20.10.7~3-0~ubuntu-focal [41.4 MB]
Get:5 https://download.docker.com/linux/ubuntu focal/stable amd64 docker-ce amd64 5:20.10.7~3-0~ubuntu-focal [24.8 MB]
Get:6 https://download.docker.com/linux/ubuntu focal/stable amd64 docker-ce-rootless-extras amd64 5:20.10.7~3-0~ubuntu-focal [9063 kB]
Get:7 https://download.docker.com/linux/ubuntu focal/stable amd64 docker-scan-plugin amd64 0.8.0~ubuntu-focal [3889 kB]
Fetched 104 MB in 17s (6216 kB/s)
Selecting prevIoUsly unselected package pigz.
(Reading database ... 32256 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting prevIoUsly unselected package containerd.io.
Preparing to unpack .../1-containerd.io_1.4.8-1_amd64.deb ...
Unpacking containerd.io (1.4.8-1) ...
Selecting prevIoUsly unselected package docker-ce-cli.
Preparing to unpack .../2-docker-ce-cli_5%3a20.10.7~3-0~ubuntu-focal_amd64.deb ...
Unpacking docker-ce-cli (5:20.10.7~3-0~ubuntu-focal) ...
Selecting prevIoUsly unselected package docker-ce.
Preparing to unpack .../3-docker-ce_5%3a20.10.7~3-0~ubuntu-focal_amd64.deb ...
Unpacking docker-ce (5:20.10.7~3-0~ubuntu-focal) ...
Selecting prevIoUsly unselected package docker-ce-rootless-extras.
Preparing to unpack .../4-docker-ce-rootless-extras_5%3a20.10.7~3-0~ubuntu-focal_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:20.10.7~3-0~ubuntu-focal) ...
Selecting prevIoUsly unselected package docker-scan-plugin.
Preparing to unpack .../5-docker-scan-plugin_0.8.0~ubuntu-focal_amd64.deb ...
Unpacking docker-scan-plugin (0.8.0~ubuntu-focal) ...
Selecting prevIoUsly unselected package slirp4netns.
Preparing to unpack .../6-slirp4netns_0.4.3-1_amd64.deb ...
Unpacking slirp4netns (0.4.3-1) ...
Setting up slirp4netns (0.4.3-1) ...
Setting up docker-scan-plugin (0.8.0~ubuntu-focal) ...
Setting up containerd.io (1.4.8-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-ce-cli (5:20.10.7~3-0~ubuntu-focal) ...
Setting up pigz (2.4-1) ...
Setting up docker-ce-rootless-extras (5:20.10.7~3-0~ubuntu-focal) ...
Setting up docker-ce (5:20.10.7~3-0~ubuntu-focal) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
invoke-rc.d: Could not determine current runlevel
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.6) ...
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ''docker run --help''.
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ docker run
"docker run" requires at least 1 argument.
See ''docker run --help''.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ docker --version
Docker version 20.10.7,build f0df350
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ''docker run --help''.
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ systemctl start docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo dockerd
INFO[2021-07-26T09:26:04.598999900+07:00] Starting up
INFO[2021-07-26T09:26:05.751575600+07:00] libcontainerd: started new containerd process  pid=4266
INFO[2021-07-26T09:26:05.751933800+07:00] parsed scheme: "unix"                         module=grpc
INFO[2021-07-26T09:26:05.752582200+07:00] scheme "unix" not registered,fallback to default scheme  module=grpc
INFO[2021-07-26T09:26:05.752789000+07:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2021-07-26T09:26:05.753058600+07:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-07-26T09:26:05.784888200+07:00] starting containerd                           revision=7eba5930496d9bbe375fdf71603e610ad737d2b2 version=1.4.8
INFO[2021-07-26T09:26:05.807969400+07:00] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2021-07-26T09:26:05.809913000+07:00] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.359366500+07:00] skip loading plugin "io.containerd.snapshotter.v1.aufs"...  error="aufs is not supported (modprobe aufs Failed: exit status 1 \"modprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-19041-Microsoft\\n\"): skip plugin" type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.360318200+07:00] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.361771600+07:00] skip loading plugin "io.containerd.snapshotter.v1.btrfs"...  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs (wslfs) must be a btrfs filesystem to be used with the btrfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.362037500+07:00] loading plugin "io.containerd.snapshotter.v1.devmapper"...  type=io.containerd.snapshotter.v1
WARN[2021-07-26T09:26:06.362243500+07:00] Failed to load plugin io.containerd.snapshotter.v1.devmapper  error="devmapper not configured"
INFO[2021-07-26T09:26:06.362974300+07:00] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.365365000+07:00] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.368026100+07:00] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.368363300+07:00] skip loading plugin "io.containerd.snapshotter.v1.zfs"...  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1
INFO[2021-07-26T09:26:06.369411200+07:00] loading plugin "io.containerd.Metadata.v1.bolt"...  type=io.containerd.Metadata.v1
WARN[2021-07-26T09:26:06.377457800+07:00] Could not use snapshotter devmapper in Metadata plugin  error="devmapper not configured"
INFO[2021-07-26T09:26:06.378196300+07:00] Metadata content store policy set             policy=shared
INFO[2021-07-26T09:26:06.384144600+07:00] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[2021-07-26T09:26:06.384857900+07:00] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[2021-07-26T09:26:06.386379300+07:00] loading plugin "io.containerd.service.v1.introspection-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.393867000+07:00] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.394944900+07:00] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.395951300+07:00] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.397012700+07:00] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.397965800+07:00] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.398988200+07:00] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.400056700+07:00] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.401187500+07:00] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[2021-07-26T09:26:06.408917100+07:00] loading plugin "io.containerd.runtime.v2.task"...  type=io.containerd.runtime.v2
INFO[2021-07-26T09:26:06.411047900+07:00] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[2021-07-26T09:26:06.412279400+07:00] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[2021-07-26T09:26:06.412639500+07:00] loading plugin "io.containerd.internal.v1.restart"...  type=io.containerd.internal.v1
INFO[2021-07-26T09:26:06.413666800+07:00] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.414645100+07:00] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.415881400+07:00] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.417013800+07:00] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.423490700+07:00] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.424583600+07:00] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.425780700+07:00] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.426810700+07:00] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.427972000+07:00] loading plugin "io.containerd.internal.v1.opt"...  type=io.containerd.internal.v1
INFO[2021-07-26T09:26:06.430384700+07:00] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.430569100+07:00] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.431579800+07:00] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.433089700+07:00] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2021-07-26T09:26:06.440447100+07:00] serving...                                    address=/var/run/docker/containerd/containerd-debug.sock
INFO[2021-07-26T09:26:06.441881300+07:00] serving...                                    address=/var/run/docker/containerd/containerd.sock.ttrpc
INFO[2021-07-26T09:26:06.443648400+07:00] serving...                                    address=/var/run/docker/containerd/containerd.sock
INFO[2021-07-26T09:26:06.444409700+07:00] containerd successfully booted in 0.663149s
INFO[2021-07-26T09:26:06.458975000+07:00] parsed scheme: "unix"                         module=grpc
INFO[2021-07-26T09:26:06.459340200+07:00] scheme "unix" not registered,fallback to default scheme  module=grpc
INFO[2021-07-26T09:26:06.459937000+07:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2021-07-26T09:26:06.461038500+07:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-07-26T09:26:06.464507500+07:00] parsed scheme: "unix"                         module=grpc
INFO[2021-07-26T09:26:06.465303100+07:00] scheme "unix" not registered,fallback to default scheme  module=grpc
INFO[2021-07-26T09:26:06.465948100+07:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2021-07-26T09:26:06.469570200+07:00] ClientConn switching balancer to "pick_first"  module=grpc
WARN[2021-07-26T09:26:06.508606600+07:00] Your kernel does not support cgroup memory limit
WARN[2021-07-26T09:26:06.509102200+07:00] Unable to find cpu cgroup in mounts
WARN[2021-07-26T09:26:06.509641700+07:00] Unable to find blkio cgroup in mounts
WARN[2021-07-26T09:26:06.511422700+07:00] Unable to find cpuset cgroup in mounts
WARN[2021-07-26T09:26:06.512210200+07:00] Unable to find pids cgroup in mounts
INFO[2021-07-26T09:26:06.513102200+07:00] Loading containers: start.
WARN[2021-07-26T09:26:06.525628500+07:00] Running iptables --wait -t nat -L -n Failed with message: `iptables v1.8.4 (legacy): can''t initialize iptables table `nat'': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.`,error: exit status 3
INFO[2021-07-26T09:26:06.633151400+07:00] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
INFO[2021-07-26T09:26:06.634747000+07:00] stopping healthcheck following graceful shutdown  module=libcontainerdINFO[2021-07-26T09:26:06.634766100+07:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
WARN[2021-07-26T09:26:07.650886300+07:00] grpc: addrConn.createTransport Failed to connect to {unix:///var/run/docker/containerd/containerd.sock  <nil> 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting...  module=grpc
Failed to start daemon: Error initializing network controller: error obtaining controller instance: Failed to create NAT chain DOCKER: iptables Failed: iptables -t nat -N DOCKER: iptables v1.8.4 (legacy): can''t initialize iptables table `nat'': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ systemctl start docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See ''docker run --help''.
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo rm -rf /etc/systemd/system/docker.service.d
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo systemctl deamon-reload
UnkNown operation deamon-reload.
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ systemctl status docker.service
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
donhuvy@VYLAPTOP:~/temp2607/reaction-development-platform$ sudo su
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# systemctl start docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down                                                                   [ OK ]
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
Executing: /lib/systemd/systemd-sysv-install enable docker
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# systemctl restart docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# systemctl restart docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# systemctl restart docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# /etc/init.d/dbus start
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ''docker run --help''.
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# service docker stop
 * Docker already stopped - file /var/run/docker-ssd.pid not found.
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# cd /var/run/docker/libcontainerd
bash: cd: /var/run/docker/libcontainerd: No such file or directory
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# service docker start
 * Starting Docker: docker                                                                                             [ OK ]
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# docker --version
Docker version 20.10.7,build f0df350
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ''docker run --help''.
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# docker run -v /var/run/docker.sock:/var/run/docker.sock
"docker run" requires at least 1 argument.
See ''docker run --help''.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# make
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Removed docker development symlink for reaction-hydra
Running pre-build hook script for reaction-hydra.
reaction-hydra post-project-start script invoked.
/bin/sh: 1: docker-compose: not found
make: *** [Makefile:264: build-reaction-hydra] Error 127
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#

root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform# sudo systemctl is-active docker
System has not been booted with systemd as init system (PID 1). Can''t operate.
Failed to connect to bus: Host is down
root@VYLAPTOP:/home/donhuvy/temp2607/reaction-development-platform#

如何解决?

解决方法

WSL 没有初始化。您需要使用使用特殊 WSL 的原生 Windows docker。

Docker 学习笔记(2):在 Windows10 虚拟机中运行 Docker

Docker 学习笔记(2):在 Windows10 虚拟机中运行 Docker

安装 VMWare 虚拟机

此处不多赘述。

VMWare 中安装 windows10

需要注意的一点是,在创建虚拟机的时候一定要把处理器的 “虚拟化引擎” 勾选上,如下图所示。 虚拟化引擎

Enjoy it

我们今天的关于Docker是在WSL中运行还是连接回Windows?docker wsl2的分享就到这里,谢谢您的阅读,如果想了解更多关于.net – Windows AZURE:类库:如何知道是在Web角色中运行还是在常规Web服务中运行、Docker for Windows和Docker在Windows上有什么区别?、Docker 在 Windows WSL 上的 Ubuntu 中运行、Docker 学习笔记(2):在 Windows10 虚拟机中运行 Docker的相关信息,可以在本站进行搜索。

本文标签: