GIS+=地理信息+容器技术(10)——Windows Server 2016的容器实践
前面我们已经将Windows Server 2016的容器组件安装完毕,这一篇我们将在Windows环境一下实践一下如何操作,不过如果各位对Linux 的容器命令比较熟悉的话,基本可以无缝对接。在Windows部署完容器组件之后,我们需要在Powershell中直接执行即可
--------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/chinagissoft
QQ群:16403743
宗旨:专注于"GIS+"前沿技术的研究与交流,将云计算技术、大数据技术、容器技术、物联网与GIS进行深度融合,探讨"GIS+"技术和行业解决方案
转载说明:文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
--------------------------------------------------------------------------------------
题记
前面我们已经将Windows Server 2016的容器组件安装完毕,这一篇我们将在Windows环境一下实践一下如何操作,不过如果各位对Linux 的容器命令比较熟悉的话,基本可以无缝对接。
在Windows部署完容器组件之后,我们需要在Powershell中直接执行即可
1、查看一下Docker命令都支持那些功能
PS C:\Windows\system32> docker
Usage: docker [OPTIONS] COMMAND [arg...]
docker daemon [ --help | ... ]
docker [ --help | -v | --version ]
A self-sufficient runtime for containers.
Options:
-b, --bridge Attach containers to a virtual switch
--config=%USERPROFILE%\.docker Location of client config files
-D, --debug Enable debug mode
--disable-legacy-registry Do not contact legacy registries
-H, --host=[] Daemon socket(s) to connect to
-h, --help Print usage
-l, --log-level=info Set the logging level
--tls Use TLS; implied by --tlsverify
--tlscacert=%USERPROFILE%\.docker\ca.pem Trust certs signed only by this CA
--tlscert=%USERPROFILE%\.docker\cert.pem Path to TLS certificate file
--tlskey=%USERPROFILE%\.docker\key.pem Path to TLS key file
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Register or log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image(s) to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code
Run 'docker COMMAND --help' for more information on a command.
2、查看一下Docker的版本
PS C:\Users\Administrator> docker version
Client:
Version: 1.10.0-dev
API version: 1.22
Go version: go1.5.1
Git commit: 18c9fe0
Built: Mon Nov 23 22:32:50 UTC 2015
OS/Arch: windows/amd64
Server:
Version: 1.10.0-dev
API version: 1.22
Go version: go1.5.1
Git commit: 18c9fe0
Built: Mon Nov 23 22:32:50 UTC 2015
OS/Arch: windows/amd64
3、查看一下Docker的系统信息
PS C:\Users\Administrator> docker info
Containers: 3
Images: 4
Server Version: 1.10.0-dev
Storage Driver: windowsfilter
Windows:
Execution Driver:
Name: Windows 1854
Build: 1.10.0-dev 18c9fe0
Default Isolation: process
Logging Driver: json-file
Plugins:
Volume: local
Network:
Kernel Version: 10.0 10586 (10586.0.amd64fre.th2_release.151029-1700)
Operating System: Windows Server 2016 Technical Preview 4
OSType: windows
Architecture: x86_64
CPUs: 2
Total Memory: 8 GiB
Name: WIN-UQSRVAL8FFF
ID: JZVI:Y3M2:N6IH:26BR:M5T4:5SRA:OCCY:VTVX:7SPB:4HJH:7M5O:KDE5
Debug mode (server): true
File Descriptors: -1
Goroutines: 22
System Time: 2016-02-07T11:34:29.5513985+08:00
EventsListeners: 0
Init SHA1:
Init Path: C:\Windows\System32\docker.exe
Docker Root Dir: C:\ProgramData\docker
4、使用镜像查询命令
PS C:\Windows\system32> docker search micorosoft
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
microsoft/aspnet ASP.NET 5 framework installed in a Windows... 1 [OK] [OK]
microsoft/django Django installed in a Windows Server Core ... 1 [OK]
microsoft/dotnet35 .NET 3.5 Runtime installed in a Windows Se... 1 [OK] [OK]
microsoft/golang Go Programming Language installed in a Win... 1 [OK]
microsoft/httpd Apache httpd installed in a Windows Server... 1 [OK]
microsoft/iis Internet Information Services (IIS) instal... 1 [OK] [OK]
microsoft/mongodb MongoDB installed in a Windows Server Core... 1 [OK]
microsoft/mysql MySQL installed in a Windows Server Core b... 1 [OK]
microsoft/nginx Nginx installed in a Windows Server Core b... 1 [OK]
microsoft/node Node installed in a Windows Server Core ba... 1 [OK]
microsoft/php PHP running on Internet Information Servic... 1 [OK]
microsoft/python Python installed in a Windows Server Core ... 1 [OK]
microsoft/rails Ruby on Rails installed in a Windows Serve... 1 [OK]
microsoft/redis Redis installed in a Windows Server Core b... 1 [OK]
microsoft/ruby Ruby installed in a Windows Server Core ba... 1 [OK]
microsoft/sqlite SQLite installed in a Windows Server Core ... 1 [OK]
microsoft/nano-golang Go Programming Language installed in a Nan... 1 [OK]
microsoft/nano-httpd Apache httpd installed in a Nano Server ba... 1 [OK]
microsoft/nano-iis Internet Information Services (IIS) instal... 1 [OK] [OK]
microsoft/nano-mysql MySQL installed in a Nano Server based con... 1 [OK]
microsoft/nano-nginx Nginx installed in a Nano Server based con... 1 [OK]
microsoft/nano-node Node installed in a Nano Server based cont... 1 [OK]
microsoft/nano-python Python installed in a Nano Server based co... 1 [OK]
microsoft/nano-rails Ruby on Rails installed in a Nano Server b... 1 [OK]
microsoft/nano-redis Redis installed in a Nano Server based con... 1 [OK]
microsoft/nano-ruby Ruby installed in a Nano Server based cont... 1 [OK]
5、查看现有镜像信息
PS C:\Windows\system32> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
windowsservercore 10.0.10586.0 6801d964fda5 3 months ago 0 B
windowsservercore latest 6801d964fda5 3 months ago 0 B
6、下载镜像(例如Python)
PS C:\Windows\system32> docker pull microsoft/python
Using default tag: latest
latest: Pulling from microsoft/python
d40b25ec08b8: Pull complete
fc04823eb7c6: Pull complete
bbac9b6f89bd: Pull complete
Digest: sha256:f26c4e6945d08032160e455d21a6bbb4c34ae4cb1bd7082b5e2eb8bbcd5c368d
Status: Downloaded newer image for microsoft/python:latest
PS C:\Windows\system32> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
microsoft/python latest bbac9b6f89bd 11 weeks ago 205.8 MB
windowsservercore 10.0.10586.0 6801d964fda5 3 months ago 0 B
windowsservercore latest 6801d964fda5 3 months ago 0 B
7、启动Python镜像
8、查看Python容器进程
PS C:\Users\Administrator> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4840f6f2413 microsoft/python "cmd" 17 minutes ago Up 17 minutes nostalgic_jang
9、查看Python容器详细信息
PS C:\Users\Administrator> docker inspect b4840f6f2413
[
{
"Id": "b4840f6f2413a36d5168cdc852fd4632f1b56a3d6ae5be6c8e83e5e1739dfd15",
"Created": "2016-02-07T03:14:02.282086Z",
"Path": "cmd",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4536,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-02-07T03:14:18.347807Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "bbac9b6f89bdb98f146c7de3e85ea92b08bbcccfd232743c67ab42bbf805a470",
"ResolvConfPath": "",
"HostnamePath": "",
"HostsPath": "",
"LogPath": "C:\\ProgramData\\docker\\containers\\b4840f6f2413a36d5168cdc852fd4632f1b56a3d6ae5be6c8e83e5e1739dfd15\\b4840f6f2413a36d5168cdc852fd4632f1b56a3d6ae5be6c8e83e5e1739dfd15-json.log",
"Name": "/nostalgic_jang",
"RestartCount": 0,
"Driver": "windowsfilter",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Links": null,
"OomKillDisable": false,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"ShmSize": 67108864,
"ConsoleSize": [
39,
125
],
"Isolation": "",
"CpuShares": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"KernelMemory": 0,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"Ulimits": null
},
"GraphDriver": {
"Name": "windowsfilter",
"Data": {
"dir": "C:\\ProgramData\\docker\\windowsfilter\\b4840f6f2413a36d5168cdc852fd4632f1b56a3d6ae5be6c8e83e5e1739dfd15"
}
},
"Mounts": [],
"Config": {
"Hostname": "b4840f6f2413",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [],
"Cmd": [
"cmd"
],
"Image": "microsoft/python",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"Description": "Python",
"Vendor": "Python Software Foundation",
"Version": "3.5.0"
},
"StopSignal": "15"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": null,
"SandboxKey": "",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": null
}
}
]
PS C:\Users\Administrator>
10、查看一下容器的文件存储信息
更多推荐
所有评论(0)