Windows10下的docker安装与入门

说明:本文是直接使用的Windows10的虚拟机,不需要下载任何的工具和虚拟机

在Windows上安装Docker

docker现在已经支持Windows直接安装了,可以直接从官网上下载,有稳定版和开发版。

首先是系统要求:

Windows 10 64位专业版,企业版和教育版,

Hyper-V要打开
具体就是,首先要打开cpu虚拟化功能,这个在BIOS里面改,可能会不成功,回复初始设置之后再改应该就可以了。
然后就是在 程序与功能>启用或关闭windows功能 中将Hyper-v打开就可以了。

然后开始安装

一路next…..
安装会自动安装 Docker Engine, Docker CLI client, Docker Compose, and Docker Machine.几个工具

安装完成之后会自动启动,如果之前的环境没有问题的话应该就可以启动了。

然后用(cmd,PowerShell)试试docker命令

//查看版本
C:\Users\63448>docker -v
Docker version 18.06.1-ce, build e68fc7a

 

//一些基本命令,可以–help 查看帮助
C:\Users\63448>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0da0a10fa9d3 nginx “nginx -g ‘daemon of…” 17 minutes ago Up 17 minutes 0.0.0.0:80->80/tcp webserver
81b213af6963 ubuntu “bash” 28 minutes ago Up 28 minutes distracted_morse

 

C:\Users\63448>docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:21:34 2018
OS/Arch: windows/amd64
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:29:02 2018
OS/Arch: linux/amd64
Experimental: false

 

C:\Users\63448>docker info
Containers: 4
Running: 2
Paused: 0
Stopped: 2
Images: 3
Server Version: 18.06.1-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 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: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155dca2105
ID: DRF6:VUQC:ZEMD:VUBL:C6LH:UM44:W5TC:TDWY:ZWOG:AGSR:H7DV:OBXS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 38
Goroutines: 70
System Time: 2018-11-01T02:23:34.2056891Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

运行一个demo

C:\Users\63448>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.
(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 an Ubuntu container with:
$ docker run -it ubuntu bash

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/get-started/

//安装成功,docker已经可以正常运行了

//docker ps 可以管理container

//docker stop/start webserver 可以启动停止之前生成的webserver

//docker rm -f webserver 可以删除container

//镜像可以用 docker images 查看

//用 docker rmi <imageID>|<imageName> 可以删除镜像

發表回覆

你的電郵地址並不會被公開。 必要欄位標記為 *