一、下载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:\Users\Maibenben\.docker\machine\cache\boot2docker.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:\Users\Maibenben\.docker\machine\cache\boot2docker.iso to C:\Users\Maibenben\.docker\machine\machines\node1\boot2docker.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:\Users\Maibenben\.docker\machine\machines\node1 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:\Users\Maibenben>SET DOCKER_TLS_VERIFY=1 C:\Users\Maibenben>SET DOCKER_HOST=tcp://192.168.99.100:2376 C:\Users\Maibenben>SET DOCKER_CERT_PATH=C:\Users\Maibenben\.docker\machine\machines\node1 C:\Users\Maibenben>SET DOCKER_MACHINE_NAME=node1 C:\Users\Maibenben>SET COMPOSE_CONVERT_WINDOWS_PATHS=true C:\Users\Maibenben>REM Run this command to configure your shell: C:\Users\Maibenben>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 的虚拟镜像