windows 安装 docker

Posted xiaobaiskill

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows 安装 docker相关的知识,希望对你有一定的参考价值。

一、下载docker

docker 下载

二、安装

  • 2.1 双击下载 程序
    技术图片
  • 2.2 next
    技术图片
  • 2.3 next
    技术图片
  • 2.4 next
    技术图片
  • 2.5 install

三、打开vbox

四、运行 Docker Quickstart Terminal

  • 4.1 这个过程会下载 boot2docker.iso, 并在vbox 上新建default虚拟镜像的
这个过程可能很漫长, 也可能安装不成功。
如果vbox中没有一直没有default的虚拟名,那么可以用下面的方法 
  • 4.2 上面如果成功了,请忽略此处,直接跳到 五
    • 4.2.1 docker-machine create --driver virtualbox node1
    Running pre-create checks...
    (node1) No default Boot2Docker ISO found locally, downloading the latest release...
    (node1) Latest release for github.com/boot2docker/boot2docker is v19.03.5
    (node1) Downloading C:UsersMaibenben.dockermachinecacheoot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v19.03.5/boot2docker.iso...
    (node1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
    Creating machine...
    (node1) Copying C:UsersMaibenben.dockermachinecacheoot2docker.iso to C:UsersMaibenben.dockermachinemachines
    ode1oot2docker.iso...
    (node1) Creating VirtualBox VM...
    (node1) Creating SSH key...
    (node1) Starting the VM...
    (node1) Check network to re-create if needed...
    (node1) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
    (node1) Found a new host-only adapter: "VirtualBox Host-Only Ethernet Adapter #2"
    (node1) Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
    (node1) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
    (node1) Waiting for an IP...
    Waiting for machine to be running, this may take a few minutes...
    Detecting operating system of created instance...
    Waiting for SSH to be available...
    Detecting the provisioner...
    Provisioning with boot2docker...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Setting Docker configuration on the remote daemon...
    Checking connection to Docker...
    Docker is up and running!
    To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env node1
    • 4.2.2 docker version
    Client:
     Version:       18.03.0-ce
     API version:   1.37
     Go version:    go1.9.4
     Git commit:    0520e24302
     Built: Fri Mar 23 08:31:36 2018
     OS/Arch:       windows/amd64
     Experimental:  false
     Orchestrator:  swarm
    error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
    • 4.2.3 上面有报错 请运行
    > docker-machine env node1
    SET DOCKER_TLS_VERIFY=1
    SET DOCKER_HOST=tcp://192.168.99.100:2376
    SET DOCKER_CERT_PATH=C:UsersMaibenben.dockermachinemachines
    ode1
    SET DOCKER_MACHINE_NAME=node1
    SET COMPOSE_CONVERT_WINDOWS_PATHS=true
    REM Run this command to configure your shell:
    REM     @FOR /f "tokens=*" %i IN ('docker-machine env node1') DO @%i
    • 4.2.4 根据 上面的提示,逐一运行(根据自己运行 docker-machine env node1,返回的结果运行)
C:UsersMaibenben>SET DOCKER_TLS_VERIFY=1

C:UsersMaibenben>SET DOCKER_HOST=tcp://192.168.99.100:2376

C:UsersMaibenben>SET DOCKER_CERT_PATH=C:UsersMaibenben.dockermachinemachines
ode1

C:UsersMaibenben>SET DOCKER_MACHINE_NAME=node1

C:UsersMaibenben>SET COMPOSE_CONVERT_WINDOWS_PATHS=true

C:UsersMaibenben>REM Run this command to configure your shell:

C:UsersMaibenben>REM     @FOR /f "tokens=*" %i IN ('docker-machine env node1') DO @%i
* 4.2.5 docker version
Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24302
 Built: Fri Mar 23 08:31:36 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server: Docker Engine - Community
 Engine:
  Version:      19.03.5
  API version:  1.40 (minimum version 1.12)
  Go version:   go1.12.12
  Git commit:   633a0ea838
  Built:        Wed Nov 13 07:28:45 2019
  OS/Arch:      linux/amd64
  Experimental: false
 containerd:
  Version:      v1.2.10
  GitCommit:            b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:      1.0.0-rc8+dev
  GitCommit:            3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:      0.18.0
  GitCommit:            fec3683

五、安装完成 可以运行了

docker search nginx

此时可以看到搜索到NGINX镜像

六 解释

docker-machine ls
// 查看 docker 在vbox 中可以可用的虚拟镜像

docker-machine create --driver virtualbox node2
// 在vbox 中 创建一个名为 node2 的虚拟镜像

以上是关于windows 安装 docker的主要内容,如果未能解决你的问题,请参考以下文章

Docker学习系列:windows下安装docker

windows server 离线安装docker

Windows下安装Docker

在windows server 2012 中安装docker

win10安装docker,空间不够怎么办?

docker安装Kafka(windows版)