美文网首页
Windows Docker install

Windows Docker install

作者: SodaCrush | 来源:发表于2024-08-21 19:06 被阅读0次

Windows Docker install

  • Windows 11 可以直接安装
  • 注意 Windows 10 需要更新到 22H2 版本及以上命令行运行
    命令行输入 winver按回车(ENTER) 查看版本号

调整本地主板虚拟化选项

进入bios
高级 -> CPU 设置 -> Internal(VMX) 虚拟化技术 -> 改成Enable -> F10保存并退出

安装wsl

参考:https://learn.microsoft.com/en-us/windows/wsl/install

以管理员身份进入cmd
wsl --install
wsl --list --online 查看可以安装的版本
wsl --install -d Ubuntu-20.04 Ubuntu-20.04 即版本号
打开管理员命令行,登录 WSL
运行命令wsl或者 wsl -u [username] username 是你之前安装的用户名
登录后,开始安装 docker

安装docker

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
sudo service docker start
sudo service docker status

安装完毕docker,将权限给当前登录用户 sudo usermod -aG docker $USER

启动 docker 命令 sudo service docker start

检查docker 运行状态 service docker status 为 "active (running)" 或者 "Docker is running" 则为正常

如遇到 Docker is not running

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

安装 docker-compose

sudo apt-get install docker-compose
sudo rm /usr/local/bin/docker-compose
sudo ln -s /usr/bin/docker-compose /usr/local/bin/docker-compose

安装网络管理
命令: sudo apt install net-tools

wsl 当中 pwd 结果为 /mnt/c/Windows/system32
表示对应 windows路径C:/Windows/system32
查询wsl内网ip:

ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -vE '^inet 127(\.[0-9]{1,3}){3}'

相关文章

网友评论

      本文标题:Windows Docker install

      本文链接:https://www.haomeiwen.com/subject/fvcikjtx.html