share facebook facebook2 twitter menu hatena pocket slack

2016.08.24 WED

Docker for Windows を 15 分くらい使ってみた

川原 洋平



Docker for Windows が 7/28 位に正式にリリースされたらしいので試してみたメモ。

Docker for Mac and Windows is Now Generally Available and Ready for Production
Today, we are excited to announce that Docker for Mac and Docker for Windows are graduating from beta and are now stable and ready for production.

興味深いのが Docker for Windows は仮想マシンに Hyper-V を利用している点。普通に使う分には Hyper-V を使っていることはユーザーは意識することは無いと思うけど。



  • 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later). In the future we will support more versions of Windows 10.
  • The Hyper-V package must be enabled. The Docker for Windows installer will enable it for you, if needed. (This requires a reboot).

64 ビット版の Windows 10 で Pro / Enterprise / Education で Hyper-V が有効になっていること。

今回利用する OS は…






インストールが完了後、再起動すると Docker Engine が起動し、タスクバーに Docker アイコンが登録される。




About Docker を選択してみる。


Settings.. を選択してみる。


色々と…PowerShell を使って触ってみる

docker version

PS C:\Users\kappa> docker version
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 21:15:28 2016
 OS/Arch:      windows/amd64

 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 21:15:28 2016
 OS/Arch:      linux/amd64

docker info

PS C:\Users\kappa> docker info
Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 2
Server Version: 1.12.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 13
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 Volume: local
 Network: null bridge overlay host
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.15-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952 GiB
Name: moby
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Insecure Registries:

お、Alpine Linux が動いているのか。


Hyper-V 上で動いている仮想マシンの状態を確認してみる。

PS C:\WINDOWS\system32> Get-VM

Name        State   CPUUsage(%) MemoryAssigned(M) Uptime           Status     Vers
----        -----   ----------- ----------------- ------           ------     ----
MobyLinuxVM Running 0           2048              01:34:33.4740000 正常稼働中 8.0

管理者権限で起動した PowerShell で Get-VM コマンドレットで稼働中の仮想マシンを確認することが出来る。

また、Hyper-V マネージャで確認することも出来る。


Hello World

PS C:\Users\kappa> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

c04b14da8d14: Already exists
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
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 Hub account:

For more examples and ideas, visit:

nginx コンテナ

PS C:\Users\kappa> docker run -d -p 80:80 nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx

51f5c6a04d83: Already exists
a3ed95caeb02: Already exists
51d229e136d0: Already exists
bcd41daec8cc: Already exists
Digest: sha256:0fe6413f3e30fcc5920bc8fa769280975b10b1c26721de956e1428b9e2f29d04
Status: Downloaded newer image for nginx:latest
PS C:\Users\kappa> docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                         NAMES
2389477365e9        nginx               "nginx -g 'daemon off"   3 seconds ago       Up 2 seconds>80/tcp, 443/tcp   silly_roentgen

PS C:\Users\kappa>   
PS C:\Users\kappa> Invoke-RestMethod -Uri "http://localhost" -outfile nginx.txt
PS C:\Users\kappa> cat nginx.txt
<!DOCTYPE html>
<title>Welcome to nginx!</title>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
 <h1>Welcome to nginx! </h1>
 <p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required. </p>

 <p>For online documentation and support please refer to
 <a href=""> </a>. <br/>
Commercial support is available at
 <a href=""> </a>. </p>

 <p> <em>Thank you for using nginx. </em> </p>

おお、普通に Docker だ。


15 分位触ってみたメモでした。

Bash も使えるようになってるし、Docker も動くし、もう Windows でいいんぢゃないかなって思ったり。


Docker for Windows を 15 分くらい使ってみた