github.com/nf/docker@v1.8.1/docs/installation/windows.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Installation on Windows"
     4  description = "Docker installation on Microsoft Windows"
     5  keywords = ["Docker, Docker documentation, Windows, requirements, virtualbox,  boot2docker"]
     6  [menu.main]
     7  parent = "smn_engine"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Windows
    12  
    13  > **Note**: This release of Docker deprecates the Boot2Docker command line in
    14  > favor of Docker Machine.  Use the Docker Toolbox to install Docker Machine as
    15  > well as the other Docker tools.
    16  
    17  You install Docker using Docker Toolbox. Docker Toolbox includes the following Docker tools:
    18  
    19  * Docker Machine for running the `docker-machine` binary
    20  * Docker Engine for running the `docker` binary
    21  * Kitematic, the Docker GUI
    22  * a shell preconfigured for a Docker command-line environment
    23  * Oracle VM VirtualBox 
    24  
    25  Because the Docker daemon uses Linux-specific kernel features, you can't run
    26  Docker natively in Windows. Instead, you must use `docker-machine` to create and attach to a Docker VM on your machine. This VM hosts Docker for you on your Windows system.
    27  
    28  The Docker VM is lightweight Linux virtual machine made specifically to run the
    29  Docker daemon on Windows. The VirtualBox VM runs completely from RAM, is a
    30  small ~24MB download, and boots in approximately 5s.
    31  
    32  ## Requirements
    33  
    34  Your machine must be running Windows 7.1, 8/8.1 or newer to run Docker. Windows 10 is not currently supported. To find out what version of Windows you have:
    35  
    36  1. Right click the Windows message and choose **System**. 
    37  
    38      ![Which version](/installation/images/win_ver.png)
    39  
    40      If you aren't using a supported version, you could consider upgrading your
    41      operating system.
    42  
    43  2. Make sure your Windows system supports Hardware Virtualization Technology and that virtualization is enabled.
    44  
    45      #### For Windows 8 or 8.1
    46  
    47      Choose **Start > Task Manager** and navigate to the **Performance** tab.          
    48      Under **CPU** you should see the following:
    49  
    50        ![Release page](/installation/images/virtualization.png)
    51  
    52      If virtualization is not enabled on your system, follow the manufacturer's instructions for enabling it.
    53  
    54      ### For Windows 7
    55  
    56      Run the <a
    57      href="http://www.microsoft.com/en-us/download/details.aspx?id=592"
    58      target="_blank"> Microsoft® Hardware-Assisted Virtualization Detection
    59      Tool</a> and follow the on-screen instructions.
    60  
    61  
    62  > **Note**: If you have Docker hosts running and you don't wish to do a Docker Toolbox
    63  installation, you can install the `docker.exe` using the *unofficial* Windows package
    64  manager Chocolately. For information on how to do this, see [Docker package on
    65  Chocolatey](http://chocolatey.org/packages/docker).
    66  
    67  ### Learn the key concepts before installing
    68  
    69  In a Docker installation on Linux, your machine is both the localhost and the
    70  Docker host. In networking, localhost means your computer. The Docker host is
    71  the machine on which the containers run.
    72  
    73  On a typical Linux installation, the Docker client, the Docker daemon, and any
    74  containers run directly on your localhost. This means you can address ports on a
    75  Docker container using standard localhost addressing such as `localhost:8000` or
    76  `0.0.0.0:8376`.
    77  
    78  ![Linux Architecture Diagram](/installation/images/linux_docker_host.svg)
    79  
    80  In an Windows installation, the `docker` daemon is running inside a Linux virtual
    81  machine. You use the Windows Docker client to talk to the Docker host VM. Your
    82  Docker containers run inside this host. 
    83  
    84  ![Windows Architecture Diagram](/installation/images/win_docker_host.svg)
    85  
    86  In Windows, the Docker host address is the address of the Linux VM. When you
    87  start the VM with `docker-machine` it is assigned an IP address. When you start
    88  a container, the ports on a container map to ports on the VM. To see this in
    89  practice, work through the exercises on this page.
    90  
    91  
    92  ### Installation
    93  
    94  If you have VirtualBox running, you must shut it down before running the
    95  installer. 
    96  
    97  1. Go to the [Docker Toolbox](https://www.docker.com/toolbox) page.
    98  
    99  2. Click the installer link to download.
   100  
   101  3. Install Docker Toolbox by double-clicking the installer.
   102  
   103      The installer launches the "Setup - Docker Toolbox" dialog.
   104  
   105      ![Install Docker Toolbox](/installation/images/win-welcome.png)
   106  
   107  4. Press "Next" to install the toolbox.
   108  
   109      The installer presents you with options to customize the standard
   110      installation. By default, the standard Docker Toolbox installation:
   111  
   112      * installs executables for the Docker tools in `C:\Program Files\Docker Toolbox` 
   113      * updates any existing VirtualBox installation 
   114      * adds a Docker Inc. folder to your program shortcuts
   115      * updates your `PATH` environment variable
   116      * adds desktop icons for the Docker Quickstart Terminal and Kitematic
   117  
   118      This installation assumes the defaults are acceptable.
   119  
   120  5. Press "Next" until you reach the "Ready to Install" page.
   121  
   122       The system prompts you for your password.
   123  
   124       ![Install](/installation/images/win-page-6.png)
   125  
   126  6. Press "Install"  to continue with the installation.
   127  
   128       When it completes, the installer provides you with some information you can
   129       use to complete some common tasks.
   130  
   131       ![All finished](/installation/images/windows-finish.png)
   132  
   133  7. Press "Close" to exit.
   134  
   135  ## Running a Docker Container
   136  
   137  To run a Docker container, you:
   138  
   139  * create a new (or start an existing) Docker virtual machine 
   140  * switch your environment to your new VM
   141  * use the `docker` client to create, load, and manage containers
   142  
   143  Once you create a machine, you can reuse it as often as you like. Like any
   144  VirtualBox VM, it maintains its configuration between uses.
   145  
   146  There are several ways to use the installed tools, from the Docker Quickstart Terminal or
   147  [from your shell](#from-your-shell).
   148  
   149  ### From the Docker Quickstart Terminal
   150  
   151  1. Find the Docker Quickstart Terminal icon on your Desktop and double-click to launch it.
   152  
   153      The application:
   154  
   155      * opens a terminal window
   156      * creates a `default` if it doesn't exist, starts the VM if it does
   157      * points the terminal environment to this VM
   158  
   159      Once the launch completes, you can run `docker` commands. 
   160  
   161  3. Verify your setup succeeded by running the `hello-world` container.
   162  
   163          $ docker run hello-world
   164          Unable to find image 'hello-world:latest' locally
   165          511136ea3c5a: Pull complete
   166          31cbccb51277: Pull complete
   167          e45a5af57b00: Pull complete
   168          hello-world:latest: The image you are pulling has been verified.
   169          Important: image verification is a tech preview feature and should not be
   170          relied on to provide security.
   171          Status: Downloaded newer image for hello-world:latest
   172          Hello from Docker.
   173          This message shows that your installation appears to be working correctly.
   174  
   175          To generate this message, Docker took the following steps:
   176          1. The Docker client contacted the Docker daemon.
   177          2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
   178             (Assuming it was not already locally available.)
   179          3. The Docker daemon created a new container from that image which runs the
   180             executable that produces the output you are currently reading.
   181          4. The Docker daemon streamed that output to the Docker client, which sent it
   182             to your terminal.
   183  
   184          To try something more ambitious, you can run an Ubuntu container with:
   185          $ docker run -it ubuntu bash
   186  
   187          For more examples and ideas, visit:
   188          http://docs.docker.com/userguide/
   189  
   190  
   191  ## Using Docker from Windows Command Line Prompt (cmd.exe)
   192  
   193  1. Launch a Windows Command Line Prompt (cmd.exe).
   194  
   195      The `docker-machine` command requires `ssh.exe` in your `PATH` environment
   196      variable. This `.exe` is in the MsysGit `bin` folder. 
   197  
   198  2. Add this to the `%PATH%` environment variable by running:
   199  
   200          set PATH=%PATH%;"c:\Program Files (x86)\Git\bin"
   201  
   202  3. Create a new Docker VM.
   203  
   204          docker-machine create --driver virtualbox my-default
   205          Creating VirtualBox VM...
   206          Creating SSH key...
   207          Starting VirtualBox VM...
   208          Starting VM...
   209          To see how to connect Docker to this machine, run: docker-machine env my-default
   210  
   211      The command also creates a machine configuration in the
   212      `C:\USERS\USERNAME\.docker\machine\machines` directory. You only need to run the `create`
   213      command once. Then, you can use `docker-machine` to start, stop, query, and
   214      otherwise manage the VM from the command line.
   215  
   216  4. List your available machines.
   217  
   218          C:\Users\mary> docker-machine ls
   219          NAME                ACTIVE   DRIVER       STATE     URL                         SWARM
   220          my-default        *        virtualbox   Running   tcp://192.168.99.101:2376  
   221  
   222      If you have previously installed the deprecated Boot2Docker application or
   223      run the Docker Quickstart Terminal, you may have a `dev` VM as well.  
   224  
   225  5. Get the environment commands for your new VM.
   226  
   227          C:\Users\mary> docker-machine env --shell cmd my-default
   228  
   229  6. Connect your shell to the `my-default` machine.
   230  
   231          C:\Users\mary> eval "$(docker-machine env my-default)"
   232  
   233  7. Run the `hello-world` container to verify your setup.
   234  
   235          C:\Users\mary> docker run hello-world
   236  
   237  ## Using Docker from PowerShell
   238  
   239  1. Launch a Windows PowerShell window.
   240  
   241  2. Add `ssh.exe` to your PATH:
   242  
   243          PS C:\Users\mary> $Env:Path = "${Env:Path};c:\Program Files (x86)\Git\bin"
   244  
   245  3. Create a new Docker VM.
   246  
   247          PS C:\Users\mary> docker-machine create --driver virtualbox my-default
   248  
   249  4. List your available machines.
   250  
   251          C:\Users\mary> docker-machine ls
   252          NAME                ACTIVE   DRIVER       STATE     URL                         SWARM
   253          my-default        *        virtualbox   Running   tcp://192.168.99.101:2376  
   254  
   255  5. Get the environment commands for your new VM.
   256  
   257          C:\Users\mary> docker-machine env --shell powershell my-default
   258  
   259  6. Connect your shell to the `my-default` machine.
   260  
   261          C:\Users\mary> eval "$(docker-machine env my-default)"
   262  
   263  7. Run the `hello-world` container to verify your setup.
   264  
   265          C:\Users\mary> docker run hello-world
   266  
   267  
   268  ## Learn about your Toolbox installation
   269  
   270  Toolbox installs the Docker Engine binary in the `C:\Program Files\Docker
   271  Toolbox` directory. When you use the Docker Quickstart Terminal or create a
   272  `default` manually, Docker Machine updates the
   273  `C:\USERS\USERNAME\.docker\machine\machines\default` folder to your
   274  system. This folder contains the configuration for the VM.
   275  
   276  You can create multiple VMs on your system with Docker Machine. So, you may have
   277  more than one VM folder if you have more than one VM. To remove a VM, use the
   278  `docker-machine rm <machine-name>` command.
   279  
   280  ## Migrate from Boot2Docker
   281  
   282  If you were using Boot2Docker previously, you have a pre-existing Docker
   283  `boot2docker-vm` VM on your local system.  To allow Docker Machine to manage
   284  this older VM, you can migrate it.
   285  
   286  1. Open a terminal or the Docker CLI on your system.
   287  
   288  2. Type the following command.
   289  
   290          $ docker-machine create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm docker-vm
   291  
   292  3. Use the `docker-machine` command to interact with the migrated VM.  
   293  
   294  The `docker-machine` subcommands are slightly different than the `boot2docker`
   295  subcommands. The table below lists the equivalent `docker-machine` subcommand
   296  and what it does:
   297  
   298  |  `boot2docker` | `docker-machine` | `docker-machine` description                             |
   299  |----------------|------------------|----------------------------------------------------------|
   300  | init           | create           | Creates a new docker host.                               |
   301  | up             | start            | Starts a stopped machine.                                |
   302  | ssh            | ssh              | Runs a command or interactive ssh session on the machine.|
   303  | save           | -                | Not applicable.                                          |
   304  | down           | stop             | Stops a running machine.                                 |
   305  | poweroff       | stop             | Stops a running machine.                                 |
   306  | reset          | restart          | Restarts a running machine.                              |
   307  | config         | inspect          | Prints machine configuration details.                    |
   308  | status         | ls               | Lists all machines and their status.                     |
   309  | info           | inspect          | Displays a machine's details.                            |
   310  | ip             | ip               | Displays the machine's ip address.                       |
   311  | shellinit      | env              | Displays shell commands needed to configure your shell to interact with a machine |
   312  | delete         | rm               | Removes a machine.                                       |
   313  | download       | -                | Not applicable.                                          |
   314  | upgrade        | upgrade          | Upgrades a machine's Docker client to the latest stable release. |
   315  
   316  
   317  ## Upgrade Docker Toolbox
   318  
   319  To upgrade Docker Toolbox, download an re-run [the Docker Toolbox
   320  installer](https://www.docker.com/toolbox).
   321  
   322  ## Container port redirection
   323  
   324  If you are curious, the username for the Docker default user is `docker` and the
   325  password is `tcuser`. The latest version of `docker-machine` sets up a host only
   326  network adaptor which provides access to the container's ports.
   327  
   328  If you run a container with a published port:
   329  
   330      $ docker run --rm -i -t -p 80:80 nginx
   331  
   332  Then you should be able to access that nginx server using the IP address
   333  reported to you using:
   334  
   335      $ docker-machine ip
   336  
   337  Typically, the IP is 192.168.59.103, but it could get changed by VirtualBox's
   338  DHCP implementation.
   339  
   340  ## Login with PUTTY instead of using the CMD
   341  
   342  Docker Machine generates and uses the public/private key pair in your
   343  `%USERPROFILE%\.ssh` directory so to log in you need to use the private key from
   344  this same directory. The private key needs to be converted into the format PuTTY
   345  uses. You can do this with
   346  [puttygen](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html):
   347  
   348  1. Open `puttygen.exe` and load ("File"->"Load" menu) the private key from
   349    `%USERPROFILE%\.ssh\id_boot2docker`
   350  
   351  2. Click "Save Private Key".
   352  
   353  3.  Use the saved file to login with PuTTY using `docker@127.0.0.1:2022`.
   354  
   355  ## Uninstallation
   356  
   357  You can uninstall Docker Toolbox using Window's standard process for removing
   358  programs. This process does not remove the `docker-install.exe` file. You must
   359  delete that file yourself.
   360  
   361  ## Learn more
   362  
   363  You can continue with the [Docker User Guide](/userguide). If you are
   364  interested in using the Kitematic GUI, see the [Kitermatic user
   365  guide](/kitematic/userguide/).