windows.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. :title: Requirements and Installation on Windows
  2. :description: Docker's tutorial to run docker on Windows
  3. :keywords: Docker, Docker documentation, Windows, requirements, virtualbox, vagrant, git, ssh, putty, cygwin
  4. Windows
  5. =========
  6. Please note the only 'official' installation is using the :ref:`ubuntu_linux` installation path. This version
  7. may be out of date because it depends on some binaries to be updated and published
  8. Requirements
  9. ------------
  10. 1. Install virtualbox from https://www.virtualbox.org - or follow this tutorial__
  11. .. __: http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7
  12. 2. Install vagrant from http://www.vagrantup.com - or follow this tutorial__
  13. .. __: http://www.slideshare.net/julienbarbier42/install-vagrant-on-windows-7
  14. 3. Install git with ssh from http://git-scm.com/downloads - or follow this tutorial__
  15. .. __: http://www.slideshare.net/julienbarbier42/install-git-with-ssh-on-windows-7
  16. We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more).
  17. Opening a command prompt
  18. ------------------------
  19. First open a cmd prompt. Press Windows key and then press “R” key. This will open the RUN dialog box for you. Type “cmd” and press Enter. Or you can click on Start, type “cmd” in the “Search programs and files” field, and click on cmd.exe.
  20. .. image:: images/win/_01.gif
  21. :alt: Git install
  22. :align: center
  23. This should open a cmd prompt window.
  24. .. image:: images/win/_02.gif
  25. :alt: run docker
  26. :align: center
  27. Alternatively, you can also use a Cygwin terminal, or Git Bash (or any other command line program you are usually using). The next steps would be the same.
  28. Launch an Ubuntu virtual server
  29. -------------------------------
  30. Let’s download and run an Ubuntu image with docker binaries already installed.
  31. .. code-block:: bash
  32. git clone https://github.com/dotcloud/docker.git
  33. cd docker
  34. vagrant up
  35. .. image:: images/win/run_02_.gif
  36. :alt: run docker
  37. :align: center
  38. Congratulations! You are running an Ubuntu server with docker installed on it. You do not see it though, because it is running in the background.
  39. Log onto your Ubuntu server
  40. ---------------------------
  41. Let’s log into your Ubuntu server now. To do so you have two choices:
  42. - Use Vagrant on Windows command prompt OR
  43. - Use SSH
  44. Using Vagrant on Windows Command Prompt
  45. ```````````````````````````````````````
  46. Run the following command
  47. .. code-block:: bash
  48. vagrant ssh
  49. You may see an error message starting with “`ssh` executable not found”. In this case it means that you do not have SSH in your PATH. If you do not have SSH in your PATH you can set it up with the “set” command. For instance, if your ssh.exe is in the folder named “C:\Program Files (x86)\Git\bin”, then you can run the following command:
  50. .. code-block:: bash
  51. set PATH=%PATH%;C:\Program Files (x86)\Git\bin
  52. .. image:: images/win/run_03.gif
  53. :alt: run docker
  54. :align: center
  55. Using SSH
  56. `````````
  57. First step is to get the IP and port of your Ubuntu server. Simply run:
  58. .. code-block:: bash
  59. vagrant ssh-config
  60. You should see an output with HostName and Port information. In this example, HostName is 127.0.0.1 and port is 2222. And the User is “vagrant”. The password is not shown, but it is also “vagrant”.
  61. .. image:: images/win/ssh-config.gif
  62. :alt: run docker
  63. :align: center
  64. You can now use this information for connecting via SSH to your server. To do so you can:
  65. - Use putty.exe OR
  66. - Use SSH from a terminal
  67. Use putty.exe
  68. '''''''''''''
  69. You can download putty.exe from this page http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  70. Launch putty.exe and simply enter the information you got from last step.
  71. .. image:: images/win/putty.gif
  72. :alt: run docker
  73. :align: center
  74. Open, and enter user = vagrant and password = vagrant.
  75. .. image:: images/win/putty_2.gif
  76. :alt: run docker
  77. :align: center
  78. SSH from a terminal
  79. '''''''''''''''''''
  80. You can also run this command on your favorite terminal (windows prompt, cygwin, git-bash, …). Make sure to adapt the IP and port from what you got from the vagrant ssh-config command.
  81. .. code-block:: bash
  82. ssh vagrant@127.0.0.1 –p 2222
  83. Enter user = vagrant and password = vagrant.
  84. .. image:: images/win/cygwin.gif
  85. :alt: run docker
  86. :align: center
  87. Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine !
  88. Running Docker
  89. --------------
  90. First you have to be root in order to run docker. Simply run the following command:
  91. .. code-block:: bash
  92. sudo su
  93. You are now ready for the docker’s “hello world” example. Run
  94. .. code-block:: bash
  95. docker run busybox echo hello world
  96. .. image:: images/win/run_04.gif
  97. :alt: run docker
  98. :align: center
  99. All done!
  100. Now you can continue with the :ref:`hello_world` example.