简介:Windows Subsystem for Linux(简称WSL)是一个在Windows 10上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。正常情况下,WSL安装完成后直接使用docker会抛出以下报错:
python
Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
历史攻略:
WSL:win10不用虚拟机、xshell也能运行Linux文件的解决方案
安装步骤:
1、正常安装WSL
2、安装 Windows Docker
3、再次运行WSL的时候即可正常使用WSL下的docker了。
python
(base) tom@L:/$ docker run -itd --name redis-test -p 6379:6379 redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis
b0a0cf830b12: Pull complete
214d0afb35ca: Pull complete
16a9d12e7a2c: Pull complete
cb9709829e8b: Pull complete
00e912971fa2: Pull complete
f7ebca356832: Pull complete
4f4fb700ef54: Pull complete
c16c264be546: Pull complete
Digest: sha256:f14f42fc7e824b93c0e2fe3cdf42f68197ee0311c3d2e0235be37480b2e208e6
Status: Downloaded newer image for redis:latest
97ee5c88fdcf903c847be92ee2e89ee6bfb376f8a2d5e6cfa25aeb9e5a43f43b
(base) tom@LAPTOP-3FI0HAN5:/mnt$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97ee5c88fdcf redis "docker-entrypoint.s..." 6 seconds ago Up 3 seconds 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis-test