下载Docker for windows
- 官网下载
- 阿里云下载
- 清华大学开源镜像站下载
开启Hyper-V虚拟机
打开“启用或关闭Windows功能”,把其中关于Hyper-V的选项都打勾。
安装Docker for Windows
当然是默认安装,一路NEXT。
配置国内镜像加速
使用Docker 中国官方镜像加速,地址https://www.docker-cn.com/registry-mirror。 也可以使用阿里云等其他服务商提供的镜像加速。
检查是否安装成功
管理员方式运行PowerShell,输入docker info
,看到类似下面的输出,说明安装成功。
PS C:\Windows\system32> docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
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: TUYJ:3RXO:5S5Y:WLFG:RBXW:PA5T:KTRO:37YI:TGWU:EHSU:YFOI:CWE7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 26
System Time: 2017-11-03T09:08:56.0820172Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://registry.docker-cn.com/
Live Restore Enabled: false
HelloWorld
运行docker run hello-world
,这条命令会输出类似如下内容:
PS C:\Windows\system32> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
5b0f327be733: Pull complete
Digest: sha256:175735360662078abd70dacb73c5518d5b3ae7c1ed069d22def5da57c3e917d6
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/
其有两行如下,说明Docker运行正常。
Hello from Docker!
This message shows that your installation appears to be working correctly.
运行一个Centos容器
docker run -it centos bash
Enjoy it
开启你的Docker探险之旅吧!