Windows子系统安装docker

Windows子系统安装docker

  1. 先升级wsl为wsl2,升级步骤可参考Windows子系统安装mysql那篇文章

  2. 安装docker

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  1. 测试下docker是否正常
luni@DESKTOP-Q66QS5Q:~$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
  1. 发现第三步报错是因为docker服务未启动,启动服务
luni@DESKTOP-Q66QS5Q:~$ sudo service docker start
 * Starting Docker: docker                                                     [ OK ]
  1. 重新测试docker
luni@DESKTOP-Q66QS5Q:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:53f1bbee2f52c39e41682ee1d388285290c5c8a76cc92b42687eecf38e0af3f0
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
posted @ 2022-08-05 22:32  不知云深处  阅读(307)  评论(0编辑  收藏  举报