Docker for Windows 中文文档(1)——Explore the application and run examples
来源:互联网 发布:随机森林优化 编辑:程序博客网 时间:2024/05/17 15:19
Get started with Docker for Windows
欢迎来到Docker for Windows!
Docker是用于创建集装箱应用程序的完整开发平台,Docker for Windows是在Windows系统上开始使用Docker的最佳方式。
检查Docker Engine,Compose和Machine的版本
启动您最喜欢的shell(cmd.exe,PowerShell或其他)来检查docker和docker-compose的版本,并验证安装。
C:\Users\rHotD>docker --versionDocker version 17.03.1-ce, build c6d412eC:\Users\rHotD>docker-compose --versiondocker-compose version 1.11.2, build f963d76fC:\Users\rHotD>docker-machine --versiondocker-machine version 0.10.0, build 76ed2a6
浏览应用程序并运行示例
接下来的几个步骤将会介绍一些例子。 这些只是在系统上试验Docker的方法的建议,检查版本信息,并确保docker命令正常工作。
1. 打开一个shell(cmd.exe,PowerShell或其他)。
2. 运行一些Docker命令,例如docker ps,docker版本和docker信息。
这是在powerhell中运行的docker ps的输出。 (在这个例子中,没有容器正在运行。)
C:\Users\rHotD>docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
以下是Docker版本的命令输出示例。
PS C:\Users\Docker> docker versionClient:Version: 17.03.0-ceAPI version: 1.26Go version: go1.7.5Git commit: 60ccb22Built: Thu Feb 23 10:40:59 2017OS/Arch: windows/amd64Server:Version: 17.03.0-ceAPI version: 1.26 (minimum version 1.12)Go version: go1.7.5Git commit: 3a232c8Built: Tue Feb 28 07:52:04 2017OS/Arch: linux/amd64Experimental: true
以下是docker信息的命令输出示例。
PS C:\Users\Docker> docker infoContainers: 0 Running: 0 Paused: 0 Stopped: 0Images: 0Server Version: 17.03.0-ceStorage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins: Volume: local Network: bridge host ipvlan macvlan null overlaySwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 977c511eda0925a723debdc94d09459af49d082arunc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70init version: 949e6faSecurity Options: seccomp Profile: defaultKernel Version: 4.9.12-mobyOperating System: Alpine Linux v3.5OSType: linuxArchitecture: x86_64CPUs: 2Total Memory: 1.934 GiBName: mobyID: BM4O:645U:LUS6:OGMD:O6WH:JINS:K7VF:OVDZ:7NE4:ZVJT:PSMQ:5UA6Docker Root Dir: /var/lib/dockerDebug Mode (client): falseDebug Mode (server): true File Descriptors: 13 Goroutines: 21 System Time: 2017-03-02T16:59:13.417299Z EventsListeners: 0Registry: https://index.docker.io/v1/Experimental: trueInsecure Registries: 127.0.0.0/8Live Restore Enabled: false
注意:上面的输出是例子。 您的输出,例如docker版本和docker信息,将取决于您的产品版本(例如,在安装较新版本时)。
3. 运行#docker run hello-world
来测试从Docker Hub拉一张图像并启动一个容器。
C:\Users\rHotD>docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world78445dd45222: Pull completeDigest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7Status: Downloaded newer image for hello-world:latestHello 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 bashShare 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/
4. 尝试更有野心的东西,并使用此命令运行Ubuntu容器。
docker run -it ubuntu bash
这将下载ubuntu容器图像并启动它。 以下是在powerhell中运行此命令的输出。
C:\Users\rHotD>docker run -it ubuntu bashUnable to find image 'ubuntu:latest' locallylatest: Pulling from library/ubuntuc62795f78da9: Pull completed4fceeeb758e: Pull complete5c9125a401ae: Pull complete0062f774e994: Pull complete6b33fd031fac: Pull completeDigest: sha256:c2bbf50d276508d73dd865cda7b4ee9b5243f2648647d21e3a471dd3cc4209a0Status: Downloaded newer image for ubuntu:latestroot@a8d217b930ac:/#
键入exit
以停止容器并关闭powerhell
。
5. 使用此命令启动Dockerized Web服务器:
docker run -d -p 80:80 --name webserver nginx
这将下载nginx
容器图像并启动它。 以下是在powerhell中运行此命令的输出。
PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginxUnable to find image 'nginx:latest' locallylatest: Pulling from library/nginxfdd5d7827f33: Pull completea3ed95caeb02: Pull complete716f7a5f3082: Pull complete7b10f03a0309: Pull completeDigest: sha256:f6a001272d5d324c4c9f3f183e1b69e9e0ff12debeb7a092730d638c33e0de3eStatus: Downloaded newer image for nginx:latestdfe13c68b3b86f01951af617df02be4897184cbf7a8b4d5caf1c3c5bd3fc267f
6. 将您的Web浏览器指向http:// localhost
以显示起始页。
(由于您指定了默认HTTP端口,因此无需在URL的末尾追加:80)
7. 当您的网络服务器正在运行时运行docker ps
,以查看容器上的详细信息。
8. 停止或移除容器和图像。 nginx
网络服务器将继续在该端口上的容器中运行,直到您停止和/或删除该容器。 如果要停止Web服务器,请键入:docker stop webserver
,并使用docker start webserver
重新启动它。
要使用单个命令停止并删除正在运行的容器,请键入:docker rm -f webserver
。 这将删除容器,而不是nginx
映像。 您可以列出本地图像与 docker 图像。 您可能想要保留一些图像,以便您不必再从Docker Hub
中拉出。 要删除不再需要的图像,请使用docker rmi
,然后使用图像ID或图像名称。 例如,docker rmi nginx
。
- Docker for Windows 中文文档(1)——Explore the application and run examples
- Docker for Windows 中文文档(3)——Docker Settings
- Docker for Windows 中文文档(2)——Set up tab completion in PowerShell
- Get started with Docker 中文文档(1)——Part 1: Orientation and Setup
- prediction and validation——explore into the future
- General-purpose and introductory examples for the scikit.
- Preparing for Application and Service Deployment - Introducing the Windows Azure Content Delivery Ne
- Build/Run Instructions for Codec Engine Examples
- Mybatis报错—— A query was run and no Result Maps were found for the Mapped Statement
- Docker Sample applications 文档 ——Quickstart: Compose and Django
- SAS Graphics for Java: Examples Using SAS AppDev Studio and the Output Delivery System
- The sample Loadrunner script below shows examples of FOR, DO and DO WHILE LOOPs.
- Get started with Docker 中文文档(2)——Part 2: Containers
- Get started with Docker 中文文档(3)—— Part 3: Services
- docker中文文档
- docker中文部分文档
- Recommendation for the Real Application Cluster Interconnect and Jumbo Frames
- Preparing for Application and Service Deployment-Application Life Cycle Management for Windows Azure
- 在Python中增加和插入元素
- Android基础回顾--Activity
- 使用sklearn做单机特征工程
- iOS开发之多工程联编
- linux的nohup命令的用法
- Docker for Windows 中文文档(1)——Explore the application and run examples
- GPS数据处理
- 一种基于特征点匹配的图像检索方法的opencv实现
- iOS多线程编程篇: Operation 对象 与 Operation Queue
- ionic2/ionic3 启动慢问题解决(apk包也变小了)
- CodeForces
- docker数据卷
- Android Matrix的使用过程
- BootStrap基础入门