Docker 按照官方範例操作
於Win10 環境下完成Docker安裝後,嘗試按照官方文件進行範例操作,來確認環境沒問題以及初步熟悉。
https://docs.docker.com/docker-for-windows/#explore-the-application-and-run-examples
docker ps
在win10 環境下可以使用CMD/PowerShell進行操作,在此嘗試使用PowerShell介面做操作練習。
啟動PowerShell介面,輸入docker ps
PS C:\Users\Nedry> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
此結果顯示目前沒有container 正在執行
docker version
輸入dokcer version 取得版本資訊
PS C:\Users\Ned> docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:12:29 2017
OS/Arch: linux/amd64
Experimental: true
docker info
輸入docker info 確認目前docker 的執行狀態
PS C:\Users\Ned> docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.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: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.60-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155d0a060f
ID: 7TOJ:YN24:NVAK:A6SF:NK2N:JDJQ:6ZWO:GYUJ:4OQP:VG4T:SU2E:OEBS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 19
Goroutines: 35
System Time: 2018-02-14T15:29:31.7043384Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
docker run hello-world
輸入docker run hello-world 從Docker Hub pulling image失敗沒反應
參考了一下微軟的文件
https://docs.microsoft.com/zh-tw/virtualization/windowscontainers/quick-start/quick-start-windows-10
使用常駐程式中的Switch to Windows containers…功能切換成windows下的容器環境,再重新輸入指令,測試就ok了,網速不快的話下載需要花一點時間。

執行docker run hello-world結果
PS C:\Users\Ned> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
407ada6e90de: Pull complete
3cb15ab58a2c: Pull complete
d6f879db0fe0: Pull complete
38257f2d38d8: Pull complete
Digest: sha256:083de497cff944f969d8499ab94f07134c50bcf5e6b9559b27182d3fa80ce3f7
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.
(windows-amd64)
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 a Windows Server container with:
PS C:\> docker run -it microsoft/windowsservercore powershell
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/
待續