Table of Content

My laptop is still win7 but want to test Docker for Windows, found it is possible to run it on win10 pro vmware vm since vmware supports nested virtualization well.

win10 pro vm setting in vmware

You need to enable visualization VT-x in vm setting,

clip0190

win10 Hyper-v

Control Panel->Programs and Features->Turn Windows features on or off, click Hyper-V , then reboot win10 vm,

clip0188

win10 pro version

Not all win10 pro supports Docker for Windows, I got this error when I first time to run Docker for Windows,

Docker for Windows requires Windows 10 Pro or Enterprise version 10586, or Windows server 2016 RTM to run.

So what is current win10 pro installed? can check in powershell like this:

Get-WmiObject -Class Win32_OperatingSystem | % Caption   
Get-WmiObject -Class Win32_OperatingSystem | % Buildnumber

For my case is 10240, did update goes to latest 16299 then above error is gone.

Docker for Windows test

there are two types of container mode, you can switch over between them:

  • Window container, it is native for window, no docker machine needed
  • Linux container, similar as Docker Toolbox, there is docker linux vm on top of Hyper-V
PS C:\Users\oldhorse> docker-machine --version
docker-machine.exe version 0.12.2, build 9371605
PS C:\Users\oldhorse> docker-compose --version
docker-compose version 1.16.1, build 6d1ac219
PS C:\Users\oldhorse> docker --version
Docker version 17.09.0-ce, build afdb6d4

C:\Users\oldhorse>docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:40:09 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:45:38 2017
 OS/Arch:      linux/amd64
 Experimental: true

C:\Users\oldhorse>docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: AHRK:4EP6:UJV2:KPSQ:BHZZ:RD6X:GCPL:V5AK:IHZG:QVDV:I2N3:KDID
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 17
 Goroutines: 27
 System Time: 2017-10-23T17:25:14.7669567Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

C:\Users\oldhorse>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
5b0f327be733: Pull complete
Digest: sha256:07d5f7800dfe37b8c2196c7b1c524c33808ce2e0f74e7aa00e603295ca9a0972
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 client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

default docker machine

When running in Linux container mode, saw there is linux vm running in Hyper Manager:
MobyLinuxVM

However when run docker-machine, cannot find this default docker machine:

docker-machine ls

Here is good explanation for it:

This is by design – Docker for Windows works differently than docker-machine. With Docker for Windows installed, we recommend using docker-machine only for remote machine creation. Basically, docker-machine expects the machine to be available through ssh which is not the case with the VM within docker for windows.

If you want to have "default" docker-machine like Docker Toolbox, here is sample:

C:\WINDOWS\system32>docker-machine create -d "hyperv" default
Running pre-create checks...
(default) Image cache directory does not exist, creating it at C:\Users\oldhorse\.docker\machine\cache...
(default) No default Boot2Docker ISO found locally, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v17.10.0-ce
(default) Downloading C:\Users\oldhorse\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v17.10.0-ce/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying C:\Users\oldhorse\.docker\machine\cache\boot2docker.iso to C:\Users\oldhorse\.docker\machine\machines\default\boot2docker.iso...
(default) Creating SSH key...
(default) Creating VM...
(default) Using switch "Default Switch"
(default) Creating VHD
(default) Starting VM...
(default) Waiting for host to start...
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 default

C:\WINDOWS\system32>docker-machine env default
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.158.110:2376
SET DOCKER_CERT_PATH=C:\Users\oldhorse\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

C:\WINDOWS\system32>@FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

C:\WINDOWS\system32>docker-machine ls
NAME      ACTIVE   DRIVER   STATE     URL                          SWARM   DOCKER        ERRORS
default   *        hyperv   Running   tcp://192.168.158.110:2376           v17.10.0-ce

C:\WINDOWS\system32>docker-machine ssh
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   

clip0191

Summary

  • as test purpose, it is possible to run Docker for Windows in win10 vmware vm on win7
  • Docker for Windows supports Window container and Linux container mode
  • Docker will work with Kubernete in Docker for Windows, discuss it in next post