docker - 从安装到试图解决问题到差点放弃到还好没有放弃(windows10家庭版WSL安装docker)

1,311 阅读1分钟
  • 安装
  • 问题1: ...Is the docker daemon running?
  • 问题2: Error response from daemon: OCI runtime create failed...

安装

Step1

$ sudo apt-get update

Step2

$ sudo apt-get install \
>    apt-transport-https \
>    ...

Step3

$ sudo apt-key fingerprint 0EBFCD88

Step4

$ sudo add-apt-repository \
>    ...

Step5

$ sudo apt-get update

Step6

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

出错啦...

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

找鸭找找鸭找...

终于,解决方案送上

This issue can be resolved permanently by running
1. systemctl enable docker
2. service docker start

看效果

  1. Error response from daemon: OCI runtime create failed...
$ docker run hello-world
...
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:338: getting the final child's pid from pipe caused: EOF: unknown.
ERRO[0012] error waiting for container: context canceled

崩溃了鸭,花了好久时间都找不到解决的办法/(ㄒoㄒ)/~~

再查了 N 多的资料后,慢慢意识到问题好像出在了兼容性上,那到底是 docker 版本有问题还是 WSL 的有问题呢?

屡次尝试删除后安装低版本的 docker ,过程略,结果是一样哒,问题似乎好像不是出在 docker 版本上

=》WSL 的版本有问题吧?????

$ wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         1
  docker-desktop         Running         2
  docker-desktop-data    Running         2

✨ 唉,将 WSL1 升级为 WSL2 试试吧

$ wsl --set-version Ubuntu 2
正在进行转换,这可能需要几分钟时间...
有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2

PS C:\Users\huawei> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

奇迹出现了

参考資料

  1. WSL 下安装 docker 踩坑
  2. medium.com/@sebagomez/…
  3. cloud.tencent.com/developer/a…
  4. docs.microsoft.com/en-us/windo…
  5. askubuntu.com/questions/1…
  6. support.circleci.com/hc/en-us/ar…
  7. blog.csdn.net/ifucking/ar…
  8. github.com/moby/moby/i…
  9. medium.com/@npalmius/m…