簡體   English   中英

在 WSL2 Ubuntu 18 LTS 上運行 docker 時出現問題

[英]Issue in running docker on WSL2 Ubuntu 18 LTS

我的 windows 10 機器上有 ubunto 18 LTS wsl2。

已安裝 docker - 請在下面的屏幕截圖中找到Docker 版本和啟動服務

現在啟動 Docker 服務后,我嘗試檢查 docker 信息,但遇到以下錯誤。

嘗試信息時出錯

我做了一些研究並發現了這篇文章 - 無法連接到位於 unix:/var/run/docker.sock 的 Docker 守護進程。 docker 守護程序是否正在運行?

正如本文所建議的, systemctl start docker也嘗試過,但出現錯誤,因為System has not been booted with systemd as init system (PID 1). Can't operate. System has not been booted with systemd as init system (PID 1). Can't operate.

另一個建議是嘗試sudo dockerd - 這導致了以下日志

INFO[2020-07-21T14:45:02.918374600+05:30] [graphdriver] using prior storage driver: overlay2
WARN[2020-07-21T14:45:03.044702300+05:30] Your kernel does not support cgroup memory limit
WARN[2020-07-21T14:45:03.046625300+05:30] Unable to find cpu cgroup in mounts
WARN[2020-07-21T14:45:03.049054700+05:30] Unable to find blkio cgroup in mounts
WARN[2020-07-21T14:45:03.051115500+05:30] Unable to find cpuset cgroup in mounts
WARN[2020-07-21T14:45:03.053056000+05:30] mountpoint for pids not found
INFO[2020-07-21T14:45:03.056254900+05:30] Loading containers: start.
WARN[2020-07-21T14:45:03.108913100+05:30] Running iptables --wait -t nat -L -n failed with message: `iptables v1.6.1: 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[2020-07-21T14:45:03.522988800+05:30] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
INFO[2020-07-21T14:45:03.523923200+05:30] stopping healthcheck following graceful shutdown  module=libcontainerd
INFO[2020-07-21T14:45:03.524034200+05:30] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
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.6.1: 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) 

sudo dockerd 日志

繼續我在上面的 iptable 問題上進行搜索,並按照論壇中的說明找到https://stackoverflow.com/questions/21983554 ,我嘗試了sudo modprobe ip_tables ,它給出了modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.4.0-18362-Microsoft

畢竟,如果我走上正軌,我需要一些指導。

從 Windows 以管理員身份運行 WSL2 Ubuntu 為我解決了這個問題。 感謝celinhoBruxo 在這里發表評論

編輯:

我的問題實際上是因為我試圖從 Windows Store 直接安裝 WSL2 Ubuntu 在不支持該版本(版本 1909)的 Windows 版本上。 我在再次安裝之前關注了此頁面,一切正常,無需從 Windows 以管理員身份運行 Ubuntu。

1.kill dockerd進程(如果沒有找到進程go為2) ps -aux | grep

殺死 -9 DOCKERD_PROCESS_ID

2.sudo dockerd &

運行dockerd成功!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM