加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Windows子系统Linux上运行Ubuntu上的Docker

发布时间:2020-12-16 03:41:16 所属栏目:安全 来源:网络整理
导读:我试图在WSL上运行Docker失败.我已按照install Docker on Ubuntu给出的步骤在WSL上安装了Docker但是当我执行docker ps时出现以下错误: docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 看着

我试图在WSL上运行Docker失败.我已按照install Docker on Ubuntu给出的步骤在WSL上安装了Docker但是当我执行docker ps时出现以下错误:

docker ps    
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

看着码头日志我发现了这个:

level=warning msg="Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-43-Microsoft/modules.dep.bin'nmodprobe: WARNING: Module nf_nat not found in directory /lib/modules/4.4.0-43-Microsoft`,error: exit status 1"
time="2017-12-28T12:07:23.227671600+01:00" level=warning msg="Running modprobe xt_conntrack failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-43-Microsoft/modules.dep.bin'nmodprobe: WARNING: Module xt_conntrack not found in directory /lib/modules/4.4.0-43-Microsoft`,error: exit status 1"
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.0: 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)

知道如何在WSL上运行Docker?

最佳答案
最后,我可以轻松地在WSL上运行Docker:首先需要在Windows上安装和运行Docker Engine,然后在Ubuntu bash上创建一个指向Windows可执行文件的符号链接:

sudo ln -s /mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe /usr/bin/docker

此链接有效,因为从Windows 10 Creators Update版本可以从Bash运行Windows可执行文件.如果Windows版本是Windows 10 Creators Update之前的版本,则可以尝试使用solution explained in this blog

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读