wsl上的docker拉取
最近刚刚更新到wsl11,发现wsl多了一个功能mirror。仔细一查,发现这个玩意还挺方便的。和主机共享ip。然后就打算配置我的docker了。
直接在docker的官网教程一行命令完成安装。https://docs.docker.com/engine/install/ubuntu/
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
确实舒服,正常情况下我需要到wsl里开代理才能用,而且wsl里开代理特麻烦,毕竟大部分代理软件都要gui的。反正托这个mirror的福,直接一键安装了docker,不过还是有点麻烦就是在跑hello_world的镜像的时候有网络问题:
(base) xlh626@DESKTOP-FCJR6B1:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/hello-world/manifests/latest": Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io": EOF
不过好在,可以调docker的代理配置,直接对着我的代理软件的详情来改就完了。

(base) xlh626@DESKTOP-FCJR6B1:~$ sudo tee /etc/docker/daemon.json << 'EOF'
{
"proxies": {
"http-proxy": "http://127.0.0.1:11888",
"https-proxy": "http://127.0.0.1:11888",
"no-proxy": "localhost,127.0.0.1"
}
}
EOF
(base) xlh626@DESKTOP-FCJR6B1:~$ sudo systemctl restart docker
再次跑一下,成功了。
(base) xlh626@DESKTOP-FCJR6B1:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
4f55086f7dd0: Pull complete
Digest: sha256:c3cbe1cc1aa588a64951ac6286e0df7b27fe2e6324b1001c619bb358770c0178
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/

浙公网安备 33010602011771号