ทดสอบการติดตั้ง Docker

1. Open a terminal window (Command Prompt or PowerShell, but not PowerShell ISE).

2. Run docker version to ensure that you have a supported version of Docker:

ดูเวอร์ชัน

[code]
PS C:\Users\phaisarn.sut> docker –version
Docker version 18.06.0-ce, build 0ffa825
[/code]

ดูเวอร์ชันแบบละเอียด

[code]
PS C:\Users\phaisarn.sut> docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:05:28 2018
OS/Arch: windows/amd64
Experimental: false

Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.24)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:23:19 2018
OS/Arch: windows/amd64
Experimental: false
[/code]

3. Pull the hello-world image from Docker Hub and run a container:

[code]
PS C:\Users\phaisarn.sut> docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
e46172273a4e: Pull complete
c012fa86f9e5: Pull complete
966bb4253d0f: Pull complete
4116cac73a40: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
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, nanoserver-1803)
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://hub.docker.com/

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

รันคำสั่งอีกทีจะเหลือแค่นี้ละ คือมี image ละ ไม่ต้อง download ใหม่

[code]
PS C:\Users\phaisarn.sut> docker run hello-world

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, nanoserver-1803)
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://hub.docker.com/

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

4. List the hello-world image that was downloaded from Docker Hub:

[code]
PS C:\Users\phaisarn.sut> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 739821c1f6d1 5 weeks ago 337MB
[/code]

5. List the hello-world container (that exited after displaying “Hello from Docker!”):

[code]
PS C:\Users\phaisarn.sut> docker container ls –all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9becde5dbaf hello-world "cmd /C ‘type C:\\hel…" 7 minutes ago Exited (0) 7 minutes ago wonderful_chatterjee
PS C:\Users\phaisarn.sut>
[/code]

6. Explore the Docker help pages by running some help commands:

[code]
> docker –help
> docker container –help
> docker container ls –help
> docker run –help
[/code]

Link