windows.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. Using Vagrant (Windows)
  6. =======================
  7. Please note this is a community contributed installation path. The only 'official' installation is using the :ref:`ubuntu_linux` installation path. This version
  8. may be out of date because it depends on some binaries to be updated and published
  9. Requirements
  10. ------------
  11. 1. Install virtualbox from https://www.virtualbox.org - or follow this tutorial__
  12. .. __: http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7
  13. 2. Install vagrant from http://www.vagrantup.com - or follow this tutorial__
  14. .. __: http://www.slideshare.net/julienbarbier42/install-vagrant-on-windows-7
  15. 3. Install git with ssh from http://git-scm.com/downloads - or follow this tutorial__
  16. .. __: http://www.slideshare.net/julienbarbier42/install-git-with-ssh-on-windows-7
  17. We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more).
  18. Opening a command prompt
  19. ------------------------
  20. 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.
  21. .. image:: images/win/_01.gif
  22. :alt: Git install
  23. :align: center
  24. This should open a cmd prompt window.
  25. .. image:: images/win/_02.gif
  26. :alt: run docker
  27. :align: center
  28. 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.
  29. Launch an Ubuntu virtual server
  30. -------------------------------
  31. Let’s download and run an Ubuntu image with docker binaries already installed.
  32. .. code-block:: bash
  33. git clone https://github.com/dotcloud/docker.git
  34. cd docker
  35. vagrant up
  36. .. image:: images/win/run_02_.gif
  37. :alt: run docker
  38. :align: center
  39. 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.
  40. Log onto your Ubuntu server
  41. ---------------------------
  42. Let’s log into your Ubuntu server now. To do so you have two choices:
  43. - Use Vagrant on Windows command prompt OR
  44. - Use SSH
  45. Using Vagrant on Windows Command Prompt
  46. ```````````````````````````````````````
  47. Run the following command
  48. .. code-block:: bash
  49. vagrant ssh
  50. 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:
  51. .. code-block:: bash
  52. set PATH=%PATH%;C:\Program Files (x86)\Git\bin
  53. .. image:: images/win/run_03.gif
  54. :alt: run docker
  55. :align: center
  56. Using SSH
  57. `````````
  58. First step is to get the IP and port of your Ubuntu server. Simply run:
  59. .. code-block:: bash
  60. vagrant ssh-config
  61. 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”.
  62. .. image:: images/win/ssh-config.gif
  63. :alt: run docker
  64. :align: center
  65. You can now use this information for connecting via SSH to your server. To do so you can:
  66. - Use putty.exe OR
  67. - Use SSH from a terminal
  68. Use putty.exe
  69. '''''''''''''
  70. You can download putty.exe from this page http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  71. Launch putty.exe and simply enter the information you got from last step.
  72. .. image:: images/win/putty.gif
  73. :alt: run docker
  74. :align: center
  75. Open, and enter user = vagrant and password = vagrant.
  76. .. image:: images/win/putty_2.gif
  77. :alt: run docker
  78. :align: center
  79. SSH from a terminal
  80. '''''''''''''''''''
  81. 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.
  82. .. code-block:: bash
  83. ssh vagrant@127.0.0.1 –p 2222
  84. Enter user = vagrant and password = vagrant.
  85. .. image:: images/win/cygwin.gif
  86. :alt: run docker
  87. :align: center
  88. Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine !
  89. Running Docker
  90. --------------
  91. First you have to be root in order to run docker. Simply run the following command:
  92. .. code-block:: bash
  93. sudo su
  94. You are now ready for the docker’s “hello world” example. Run
  95. .. code-block:: bash
  96. docker run busybox echo hello world
  97. .. image:: images/win/run_04.gif
  98. :alt: run docker
  99. :align: center
  100. All done!
  101. Now you can continue with the :ref:`hello_world` example.