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