💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Windows部署Docker ![](https://img.kancloud.cn/60/62/60625e20c6d31072da885e0b44f5b3f7_480x270.png) > #### 手册阅读须知: > 本手册仅针对windows10版本做详情介绍,win7,win8环境也可作为部署环境部署,本手册仅针对Docker部署版本(使用左右键(`<-- 和 -->`)翻页阅读) * * * # Docker——准备前工作 ![](https://img.kancloud.cn/a7/37/a7378ab56c7b357966ecc6a52bd6b13e_200x132.png) > Windows部署Docker前,需要做一些准备,以下为Windows部署Docker前所必须的,请详细阅读Windows部署Docker准备使用书,以保证部署执行效率,感谢阅读. ## Windows部署Docker准备工作步骤: * [ ] > ### **`Win10 系统`**: Docker Desktop 是 Docker 在 Windows 10 和 macOS 操作系统上的官方安装方式,这个方法依然属于先在虚拟机中安装 Linux 然后再安装 Docker 的方法。 Docker Desktop 官方下载地址:[https://docs.docker.com/desktop/install/windows-install/](https://docs.docker.com/desktop/install/windows-install/) <span style="color:red">**注意:**此方法仅适用于 Windows 10 操作系统专业版、企业版、教育版和部分家庭版! * [ ] > ### **`安装 Hyper-V`**: Hyper-V 是微软开发的虚拟机,类似于 VMWare 或 VirtualBox,仅适用于 Windows 10。这是 Docker Desktop for Windows 所使用的虚拟机。但是,这个虚拟机一旦启用,QEMU、VirtualBox 或 VMWare Workstation 15 及以下版本将无法使用!如果你必须在电脑上使用其他虚拟机(例如开发 Android 应用必须使用的模拟器),请不要使用 Hyper-V! * [ ] ### 开启 Hyper-V ![](https://www.runoob.com/wp-content/uploads/2017/12/1513668234-4363-20171206211136409-1609350099.png) 程序和功能 ![](https://www.runoob.com/wp-content/uploads/2017/12/1513668234-4368-20171206211345066-1430601107.png) 启用或关闭Windows功能 ![](https://www.runoob.com/wp-content/uploads/2017/12/1513668234-9748-20171206211435534-1499766232.png) 选中Hyper-V ![](https://www.runoob.com/wp-content/uploads/2017/12/1513668234-6433-20171206211858191-1177002365.png) 也可以通过命令来启用 Hyper-V ,请右键开始菜单并以管理员身份运行 PowerShell,执行以下命令: ~~~ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All ~~~ > ### **`安装 Docker Desktop for Windows`**: 点击[Get started with Docker Desktop](https://hub.docker.com/?overlay=onboarding),并下载 Windows 的版本,如果你还没有登录,会要求注册登录: ![](https://www.runoob.com/wp-content/uploads/2016/05/5AEB69DA-6912-4B08-BE79-293FBE659894.png) ### 运行安装文件 双击下载的 Docker for Windows Installer 安装文件,一路 Next,点击 Finish 完成安装。 ![](https://www.runoob.com/wp-content/uploads/2017/12/1513669129-6146-20171206214940331-1428569749.png) ![](https://www.runoob.com/wp-content/uploads/2017/12/1513668903-9668-20171206220321613-1349447293.png) 安装完成后,Docker 会自动启动。通知栏上会出现个小鲸鱼的图标![](https://www.runoob.com/wp-content/uploads/2017/12/1513582421-4552-whale-x-win.png),这表示 Docker 正在运行。 桌边也会出现三个图标,如下图所示: 我们可以在命令行执行 docker version 来查看版本号,docker run hello-world 来载入测试镜像测试。 如果没启动,你可以在 Windows 搜索 Docker 来启动: ![](https://www.runoob.com/wp-content/uploads/2017/12/1513585082-6751-docker-app-search.png) 启动后,也可以在通知栏上看到小鲸鱼图标: ![](https://www.runoob.com/wp-content/uploads/2017/12/1513585123-3777-whale-taskbar-circle.png) > 如果启动中遇到因 WSL 2 导致地错误,请安装[WSL 2](https://docs.microsoft.com/zh-cn/windows/wsl/install-win10)。 安装之后,可以打开 PowerShell 并运行以下命令检测是否运行成功: ~~~ docker run hello-world ~~~ 在成功运行之后应该会出现以下信息: ![](https://www.runoob.com/wp-content/uploads/2016/05/EmkOezweLQVIwA1T__original.png) > ### **`win7、win8 系统(作者未尝试此种部署方式,遇到问题,请自行百度)`**: win7、win8 等需要利用 docker toolbox 来安装,国内可以使用阿里云的镜像来下载,下载地址:[http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/](http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/) 安装比较简单,双击运行,点下一步即可,可以勾选自己需要的组件: ![](https://www.runoob.com/wp-content/uploads/2016/05/691999-20180512142142130-1831870973.png) docker toolbox 是一个工具集,它主要包含以下一些内容: * Docker CLI - 客户端,用来运行 docker 引擎创建镜像和容器。 * Docker Machine - 可以让你在 Windows 的命令行中运行 docker 引擎命令。 * Docker Compose - 用来运行 docker-compose 命令。 * Kitematic - 这是 Docker 的 GUI 版本。 * Docker QuickStart shell - 这是一个已经配置好Docker的命令行环境。 * Oracle VM Virtualbox - 虚拟机。 下载完成之后直接点击安装,安装成功后,桌边会出现三个图标,如下图所示: ![](https://www.runoob.com/wp-content/uploads/2017/12/icon-set.png) 点击 Docker QuickStart 图标来启动 Docker Toolbox 终端。 如果系统显示 User Account Control 窗口来运行 VirtualBox 修改你的电脑,选择 Yes。 ![](https://www.runoob.com/wp-content/uploads/2017/12/1513667960-3359-b2d-shell.png) $符号那里可以输入以下命令来执行。 ~~~ $ docker run hello-world Unable to find image 'hello-world:latest' locally Pulling repository hello-world 91c95931e552: Download complete a8219747be10: Download complete 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 Engine CLI client contacted the Docker Engine daemon. 2. The Docker Engine daemon pulled the "hello-world" image from the Docker Hub. (Assuming it was not already locally available.) 3. The Docker Engine daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker Engine daemon streamed that output to the Docker Engine CLI client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash For more examples and ideas, visit: https://docs.docker.com/userguide/ ~~~