Docker for Windows-based Chinese Document (1) - Get started

Keywords: Docker Ubuntu Windows Linux

Get started with Docker for Windows

Welcome to Docker for Windows!

Docker is a complete development platform for creating container applications, and Docker for Windows is the best way to start using Docker on Windows systems.

Check the versions of Docker Engine, Compose and Machine

Start your favorite shell (cmd.exe, PowerShell or others) to check the versions of docker and docker-compose and verify the installation.

C:\Users\rHotD>docker --version
Docker version 17.03.1-ce, build c6d412e

C:\Users\rHotD>docker-compose --version
docker-compose version 1.11.2, build f963d76f

C:\Users\rHotD>docker-machine --version
docker-machine version 0.10.0, build 76ed2a6

Browse the application and run the example

The next few steps will introduce some examples. These are just suggestions for experimenting with Docker's methods on the system, checking version information, and ensuring that the docker command works properly.

  • Open a shell (cmd.exe, PowerShell or others).
  • Run some Docker commands, such as docker ps, docker version and docker information.

This is the output of dockers running in the powerhell. (In this case, no container is running.)

C:\Users\rHotD>docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

The following is an example of command output for the Docker version.

PS C:\Users\Docker> docker version
Client:
Version:      17.03.0-ce
API version:  1.26
Go version:   go1.7.5
Git commit:   60ccb22
Built:        Thu Feb 23 10:40:59 2017
OS/Arch:      windows/amd64

Server:
Version:      17.03.0-ce
API version:  1.26 (minimum version 1.12)
Go version:   go1.7.5
Git commit:   3a232c8
Built:        Tue Feb 28 07:52:04 2017
OS/Arch:      linux/amd64
Experimental: true

The following is an example of command output for docker information.

PS C:\Users\Docker> docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.03.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
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 977c511eda0925a723debdc94d09459af49d082a
runc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.12-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934 GiB
Name: moby
ID: BM4O:645U:LUS6:OGMD:O6WH:JINS:K7VF:OVDZ:7NE4:ZVJT:PSMQ:5UA6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 13
 Goroutines: 21
 System Time: 2017-03-02T16:59:13.417299Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Note: The output above is an example. Your output, such as docker version and docker information, will depend on your product version (for example, when installing a newer version).

  • Run # docker run hello-world to test pulling an image from Docker Hub and starting a container.
C:\Users\rHotD>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
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/
  • Try something more ambitious and use this command to run the Ubuntu container.
    docker run -it ubuntu bash
    This will download the ubuntu container image and start it. The following is the output of running this command in the powershell.
C:\Users\rHotD>docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
c62795f78da9: Pull complete
d4fceeeb758e: Pull complete
5c9125a401ae: Pull complete
0062f774e994: Pull complete
6b33fd031fac: Pull complete
Digest: sha256:c2bbf50d276508d73dd865cda7b4ee9b5243f2648647d21e3a471dd3cc4209a0
Status: Downloaded newer image for ubuntu:latest
root@a8d217b930ac:/#

Type exit to stop the container and close the powerhell.

  • Use this command to start the Dockerized Web server:

docker run -d -p 80:80 --name webserver nginx

This will download the nginx container image and start it. The following is the output of running this command in the powershell.

Posted by jsnyder2k on Wed, 12 Dec 2018 20:39:07 -0800