Windows上安装Docker

Windows Docker 安装


win七、win8 系统

win七、win8 等须要利用 docker toolbox 来安装,国内可使用阿里云的镜像来下载,下载地址:http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/html

docker toolbox 是一个工具集,它主要包含如下一些内容:git

Docker CLI 客户端,用来运行docker引擎建立镜像和容器
Docker Machine. 可让你在windows的命令行中运行docker引擎命令
Docker Compose. 用来运行docker-compose命令
Kitematic. 这是Docker的GUI版本
Docker QuickStart shell. 这是一个已经配置好Docker的命令行环境
Oracle VM Virtualbox. 虚拟机

下载完成以后直接点击安装,须要注意的是这里,若是电脑已安装git,能够不勾选
在这里插入图片描述github

安装成功后,桌边会出现三个图标,入下图所示:docker

点击 Docker QuickStart 图标来启动 Docker Toolbox 终端。shell

若是git是以前本身已安装好的,此时会提示window正在查找bash.exe,选择浏览找到本身安装git目录下bin文件夹的bash.exe
在这里插入图片描述json

打开后,若在bash界面提示没有boot2docker镜像,须要在github上下载,提示大概以下ubuntu

在这里插入图片描述

这是由于没有找到默认的boot2docker镜像的缘由,提示正在下载,然而github的下载速度不可恭维,
(boot2docker下载地址:https://github.com/boot2docker/boot2docker/releases),
需注意的是不一样版本的docker须要的boot2docker版本也不同,其实根本不用下载,以前下载好的toolbox的根目录下就有windows

在这里插入图片描述

将boot2docker.iso文件复制到C:\Users\Administrator.docker\machine\cache路径下,再次运行Docker Quickstart Terminal。bash

再次运行若是仍是不行,通常是提示boot2docker版本过旧,此时就仍是老老实实等待下载吧,其实速度也仍是能够的。网络

再次运行若是成功的话窗口会出现小鲸鱼的图案(docker的logo),以下图:

在这里插入图片描述

还能够在cmd里验证一下,出现下图即为安装成功:

在这里插入图片描述

 

若是系统显示 User Account Control 窗口来运行 VirtualBox 修改你的电脑,选择 Yes。

 

$ 符号那你能够输入如下命令来执行。

$ 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/

Win10 系统

如今 Docker 有专门的 Win10 专业版系统的安装包,须要开启Hyper-V。

开启 Hyper-V

 

一、安装 Toolbox

最新版 Toolbox 下载地址: https://www.docker.com/get-docker

点击 Download Desktop and Take a Tutorial,并下载 Windows 的版本,若是你尚未登陆,会要求注册登陆:

二、运行安装文件

双击下载的 Docker for Windows Installer 安装文件,一路 Next,点击 Finish 完成安装。

安装完成后,Docker 会自动启动。通知栏上会出现个小鲸鱼的图标,这表示 Docker 正在运行。

桌边也会出现三个图标,入下图所示:

咱们能够在命令行执行 docker version 来查看版本号,docker run hello-world 来载入测试镜像测试。

若是没启动,你能够在 Windows 搜索 Docker 来启动:

启动后,也能够在通知栏上看到小鲸鱼图标:


镜像加速

鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,咱们能够须要配置提速器来解决,我使用的是网易的镜像地址:http://hub-mirror.c.163.com。

新版的 Docker 使用 /etc/docker/daemon.json(Linux) 或者 %programdata%\docker\config\daemon.json(Windows) 来配置 Daemon。

请在该配置文件中加入(没有该文件的话,请先建一个):

{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

 

转自:

https://www.runoob.com/docker/windows-docker-install.html

https://blog.csdn.net/weixin_41430952/article/details/83745458

相关文章
相关标签/搜索