在WINDOWS 10 WSL1 的子系统下完美解决DOCKER的命令问题
在Windows 10 (1909)安装了子系统ubuntu-20.04与windows-docker-2.3.0.3,在WSL1命令行下执行“docker ps”会出现如下问题:
The command 'docker' could not be found in this WSL 1 distro. We recommend to convert this distro to WSL 2 and activate the WSL integration in Docker Desktop settings. See https://docs.docker.com/docker-for-windows/wsl/ for details.
解决方案
首先在docker setting上设置如下图(红圈钩选中部份)
打开Ubuntu Shell,执行以下命令:
wsl sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - sudo apt remove gpg sudo apt install gnupg1 sudo apt install software-properties-common sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get -y update #先查询有哪些docker版本 apt-cache madison docker-ce #安装最新版 sudo apt-get install -y docker-ce #安装指定版要,比如安装5:19.03.6~3-0~ubuntu-bionic版本,-y参数有示非交互安装,有交互的时候自动传y参数。 sudo apt-get install -y docker-ce=5:19.03.6~3-0~ubuntu-bionic echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
然后重启windows的Docker,
zhongyulin@LAPTOP-8SHV4IL8:~$ docker version Client: Docker Engine - Community Version: 20.10.9 API version: 1.41 Go version: go1.16.8 Git commit: c2ea9bc Built: Mon Oct 4 16:08:29 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.7 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: b0f5bc3 Built: Wed Jun 2 11:54:58 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.6 GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d runc: Version: 1.0.0-rc95 GitCommit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7 docker-init: Version: 0.19.0 GitCommit: de40ad0
参考:
https://www.freesion.com/article/17971075268/
https://www.cnblogs.com/yyee/p/12922221.html
分类:
docker
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2016-10-20 linux shell 找端口号及对应的进程
2016-10-20 (转)shell:读取文件的每一行内容并输出