Welcome to Docker for Windows!

Docker is a full development platform for creating containerized apps, and Docker for Windows is the best way to get started with Docker on Windows systems.

Got Docker for Windows? If you have not yet installed Docker for Windows, please see Install Docker for Windowsfor an explanation of stable  and edge channels, system requirements, and download/install information.

Looking for system requirements? Check out What to know before you install, which has moved to the new install topic.

Check versions of Docker Engine, Compose, and Machine

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

PS C:\Users\Docker> docker --version
Docker version 17.03.0-ce, build 60ccb22 PS C:\Users\Docker> docker-compose --version
docker-compose version 1.11.2, build dfed245 PS C:\Users\Docker> docker-machine --version
docker-machine version 0.10.0, build 76ed2a6

Explore the application and run examples

The next few steps take you through some examples. These are just suggestions for ways to experiment with Docker on your system, check version information, and make sure docker commands are working properly.

  1. Open a shell (cmd.exe, PowerShell, or other).

  2. Run some Docker commands, such as docker psdocker version, and docker info.

    Here is the output of docker ps run in a powershell. (In this example, no containers are running yet.)

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

    Here is an example of command output for 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

    Here is an example of command output for docker info.

    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 outputs above are examples. Your output for commands like docker version and docker infowill vary depending on your product versions (e.g., as you install newer versions).

  3. Run docker run hello-world to test pulling an image from Docker Hub and starting a container.

    PS C:\Users\jdoe> 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.
    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.
  4. Try something more ambitious, and run an Ubuntu container with this command.

    PS C:\Users\jdoe> docker run -it ubuntu bash

    This will download the ubuntu container image and start it. Here is the output of running this command in a powershell.

    PS C:\Users\jdoe> docker run -it ubuntu bash
    
    Unable to find image 'ubuntu:latest' locally
    latest: Pulling from library/ubuntu
    5a132a7e7af1: Pull complete
    fd2731e4c50c: Pull complete
    28a2f68d1120: Pull complete
    a3ed95caeb02: Pull complete
    Digest: sha256:4e85ebe01d056b43955250bbac22bdb8734271122e3c78d21e55ee235fc6802d
    Status: Downloaded newer image for ubuntu:latest

    Type exit to stop the container and close the powershell.

  5. Start a Dockerized webserver with this command:

    PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginx

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

    PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginx
    
    Unable to find image 'nginx:latest' locally
    latest: Pulling from library/nginx fdd5d7827f33: Pull complete
    a3ed95caeb02: Pull complete
    716f7a5f3082: Pull complete
    7b10f03a0309: Pull complete
    Digest: sha256:f6a001272d5d324c4c9f3f183e1b69e9e0ff12debeb7a092730d638c33e0de3e
    Status: Downloaded newer image for nginx:latest
    dfe13c68b3b86f01951af617df02be4897184cbf7a8b4d5caf1c3c5bd3fc267f

Point your web browser at http://localhost to display the start page.

(Since you specified the default HTTP port, it isn’t necessary to append :80 at the end of the URL.)

  1. Run docker ps while your webserver is running to see details on the container.

    PS C:\Users\jdoe> docker ps
    
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS
    NAMES
    dfe13c68b3b8 nginx "nginx -g 'daemon off" 3 days ago Up 45 seconds 0.0.0.0:80->80/tcp, 443/tc
    p webserver

Stop or remove containers and images.

The nginx webserver will continue to run in the container on that port until you stop and/or remove the container. If you want to stop the webserver, type: docker stop webserver and start it again with docker start webserver.

To stop and remove the running container with a single command, type: docker rm -f webserver. This will remove the container, but not the nginx image. You can list local images with docker images. You might want to keep some images around so that you don’t have to pull them again from Docker Hub. To remove an image you no longer need, use docker rmi followed by an image ID or image name. For example, docker rmi nginx.

Get started with Docker for Windows的更多相关文章

  1. Docker for Windows使用简介

    在上一篇文章中,通过演练指导的方式,介绍了在Docker中运行ASP.NET Core Web API应用程序的过程.本文将介绍Docker for Windows的使用. 先决条件 前两周时间,Do ...

  2. 关于docker在windows环境下运行的第一次体验

    关于docker在windows环境下执行的原理 1.1.           首先是Docker Quickstart启动,如果在虚拟机Oracle VM VirtualBox不存在default虚 ...

  3. 初识Docker和Windows Server容器

    概览 伴随着Windows Server 2016 Technical Preview 3 (TP3)版本的发布,微软首次提供了Windows平台下地原生容器.它集成了Docker对Windows S ...

  4. 解决 docker on windows下网络不通

    问题:公司有一台闭置的windows服务器,于是想利用起来,但是在启动容器后始终无法通信成功. 研究: 1. 发现安装包中包含virtualbox, 于是怀疑windows下的docker是在virt ...

  5. Docker for Windows

    Docker for Windows使用简介 在上一篇文章中,通过演练指导的方式,介绍了在Docker中运行ASP.NET Core Web API应用程序的过程.本文将介绍Docker for Wi ...

  6. ASP.NET Core 2.0 in Docker on Windows Container

    安装Docker for Windows https://store.docker.com/editions/community/docker-ce-desktop-windows 要想将一个ASP. ...

  7. Docker for Windows 使用入门

    欢迎来到Docker for Windows! Docker是用于创建Docker应用程序的完整开发平台,Docker for Windows是在Windows系统上开始使用Docker的最佳方式. ...

  8. Windows 10 安装 Docker for Windows

    Docker for Windows是Docker社区版(CE)应用程序. Docker for Windows安装包包括在Windows系统上运行Docker所需的一切. 本主题介绍了预安装注意事项 ...

  9. docker for windows & dotnet core app

    Step 1: 安装docker for windows Step 2: 从github 上 clone 源代码:https://github.com/dotnet/dotnet-docker-sam ...

  10. 学习docker on windows (1): 为什么要使用docker

    为什么要用Docker? 如果我们想使用某种pc软件, 那么在互联网上查找并安装软件的流程大致如下图: 那么这就有几个问题要弄清楚: 从哪里获得软件 App Store Linux的包管理 从某些网站 ...

随机推荐

  1. AJAX请求返回HTTP 400 错误 - 请求无效 (Bad request)

    在ajax请求后台数据时有时会报HTTP400错误-请求无效(Badrequest);出现这个请求无效报错说明请求没有进入到后台服务里: 原因: 1)前端提交数据的字段名称或者是字段类型和后台的实体类 ...

  2. Java hashCode() equals()总结

    1.hashCode的存在主要是用于查找的快捷性,如Hashtable,HashMap等,hashCode是用来在散列存储结构中确定对象的存储地址的: 2.如果两个对象相同,就是适用于equals(j ...

  3. 快速搭建日志系统——ELK STACK

    什么是ELK STACK ELK Stack是Elasticserach.Logstash.Kibana三种工具组合而成的一个日志解决方案.ELK可以将我们的系统日志.访问日志.运行日志.错误日志等进 ...

  4. 如何选择分布式事务形态(TCC,SAGA,2PC,补偿,基于消息最终一致性等等)

    各种形态的分布式事务 分布式事务有多种主流形态,包括: 基于消息实现的分布式事务 基于补偿实现的分布式事务(gts/fescar自动补偿的形式) 基于TCC实现的分布式事务 基于SAGA实现的分布式事 ...

  5. .NetCore实践爬虫系统(一)解析网页内容

    爬虫系统的意义 爬虫的意义在于采集大批量数据,然后基于此进行加工/分析,做更有意义的事情.谷歌,百度,今日头条,天眼查都离不开爬虫. 今日目标 今天我们来实践一个最简单的爬虫系统.根据Url来识别网页 ...

  6. Go+Python双剑合璧

    目的 Python调用Go的方法,Python有很多功能强悍又使用简洁的库.而新生军Go的多核心利用率也是非常强悍的.当然这是明面上的优点.反正你有很多理由想要让Python能够调用Go的方法. 实验 ...

  7. Eclipse新建Maven工程——git篇

    1.eclipse,新建一个maven工程,步骤如下图: 右键新建的工程 发布前后工程对比如下: 2.发布为本地仓库 因为项目中,不是所有的文件,都需要提交到githut上,所以需要把不需要提交的问题 ...

  8. Jenkins- job之间传参

    前言: 本文介绍插件: Parameterized Trigger plugin的具体使用方法. 一.插件介绍 Parameterized Trigger plugin插件可以让你在构建完成时触发新的 ...

  9. 【转】ubuntu 双机热备

    1.关于软件安装 sudo apt-get install libssl-dev sudo apt-get install openssl sudo apt-get install libpopt-d ...

  10. CopyOnWriteArrayList源码分析

    基于jdk1.7源码 一.无锁容器 CopyOnWriteArrayList是JDK5中添加的新的容器,除此之外,还有CopyOnWriteArraySet.ConcurrentHahshMap和Co ...