赞
踩
WSL安装docker(不折腾版)
启动失败解决方案:WSL Docker : Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
wsl一定要是WSL2,否则,启动docker会报错:
WSL Docker : Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
如果你是WSL1,打开powershell终端:
C:> wsl.exe -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 1
docker-desktop-data Running 2
docker-desktop Running 2
发现ubuntu20.04 是 WSL1 而不是 WSL2,进行升级
C:> wsl.exe --set-version ubuntu-20.04 2
正在进行转换,这可能需要几分钟时间...
有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2
转换完成。
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo su
export DOCKER_HOST=tcp://localhost:2375 //永久性参考:https://www.cnblogs.com/SH170706/p/10242505.html
service docker start
试一下执行docker命令:
docker version
若输出以下结果,则说明成功
Client: Version: 18.03.1-ce API version: 1.37 Go version: go1.9.5 Git commit: 9ee9f40 Built: Wed Jun 20 21:43:51 2018 OS/Arch: linux/amd64 Experimental: false Orchestrator: swarm Server: Engine: Version: 18.03.1-ce API version: 1.37 (minimum version 1.12) Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:22:38 2018 OS/Arch: linux/amd64 Experimental: false
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。