mac.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. :title: Requirements and Installation on Mac OS X 10.6 Snow Leopard
  2. :description: Please note this project is currently under heavy development. It should not be used in production.
  3. :keywords: Docker, Docker documentation, requirements, virtualbox, ssh, linux, os x, osx, mac
  4. .. _macosx:
  5. ========
  6. Mac OS X
  7. ========
  8. .. note::
  9. These instructions are available with the new release of Docker
  10. (version 0.8). However, they are subject to change.
  11. .. include:: install_header.inc
  12. Docker is supported on Mac OS X 10.6 "Snow Leopard" or newer.
  13. How To Install Docker On Mac OS X
  14. =================================
  15. VirtualBox
  16. ----------
  17. Docker on OS X needs VirtualBox to run. To begin with, head over to
  18. `VirtualBox Download Page`_ and get the tool for ``OS X hosts x86/amd64``.
  19. .. _VirtualBox Download Page: https://www.virtualbox.org/wiki/Downloads
  20. Once the download is complete, open the disk image, run the set up file
  21. (i.e. ``VirtualBox.pkg``) and install VirtualBox. Do not simply copy the
  22. package without running the installer.
  23. boot2docker
  24. -----------
  25. `boot2docker`_ provides a handy script to easily manage the VM running the
  26. ``docker`` daemon. It also takes care of the installation for the OS image
  27. that is used for the job.
  28. .. _GitHub page: https://github.com/steeve/boot2docker
  29. Open up a new terminal window, if you have not already.
  30. Run the following commands to get boot2docker:
  31. .. code-block:: bash
  32. # Enter the installation directory
  33. cd ~/bin
  34. # Get the file
  35. curl https://raw.github.com/steeve/boot2docker/master/boot2docker > boot2docker
  36. # Mark it executable
  37. chmod +x boot2docker
  38. Docker OS X Client
  39. ------------------
  40. The ``docker`` daemon is accessed using the ``docker`` client.
  41. Run the following commands to get it downloaded and set up:
  42. .. code-block:: bash
  43. # Get the file
  44. curl -o docker https://get.docker.io/builds/Darwin/x86_64/docker-latest
  45. # Mark it executable
  46. chmod +x docker
  47. # Set the environment variable for the docker daemon
  48. export DOCKER_HOST=tcp://
  49. # Copy the executable file
  50. sudo cp docker /usr/local/bin/
  51. And that’s it! Let’s check out how to use it.
  52. How To Use Docker On Mac OS X
  53. =============================
  54. The ``docker`` daemon (via boot2docker)
  55. ---------------------------------------
  56. Inside the ``~/bin`` directory, run the following commands:
  57. .. code-block:: bash
  58. # Initiate the VM
  59. ./boot2docker init
  60. # Run the VM (the docker daemon)
  61. ./boot2docker up
  62. # To see all available commands:
  63. ./boot2docker
  64. # Usage ./boot2docker {init|start|up|pause|stop|restart|status|info|delete|ssh|download}
  65. The ``docker`` client
  66. ---------------------
  67. Once the VM with the ``docker`` daemon is up, you can use the ``docker``
  68. client just like any other application.
  69. .. code-block:: bash
  70. docker version
  71. # Client version: 0.7.6
  72. # Go version (client): go1.2
  73. # Git commit (client): bc3b2ec
  74. # Server version: 0.7.5
  75. # Git commit (server): c348c04
  76. # Go version (server): go1.2
  77. SSH-ing The VM
  78. --------------
  79. If you feel the need to connect to the VM, you can simply run:
  80. .. code-block:: bash
  81. ./boot2docker ssh
  82. # User: docker
  83. # Pwd: tcuser
  84. You can now continue with the :ref:`hello_world` example.
  85. Learn More
  86. ==========
  87. boot2docker:
  88. ------------
  89. See the GitHub page for `boot2docker`_.
  90. .. _boot2docker: https://github.com/steeve/boot2docker
  91. If SSH complains about keys:
  92. ----------------------------
  93. .. code-block:: bash
  94. ssh-keygen -R '[localhost]:2022'
  95. About the way Docker works on Mac OS X:
  96. ---------------------------------------
  97. Docker has two key components: the ``docker`` daemon and the ``docker``
  98. client. The tool works by client commanding the daemon. In order to
  99. work and do its magic, the daemon makes use of some Linux Kernel
  100. features (e.g. LXC, name spaces etc.), which are not supported by OS X.
  101. Therefore, the solution of getting Docker to run on OS X consists of
  102. running it inside a lightweight virtual machine. In order to simplify
  103. things, Docker comes with a bash script to make this whole process as
  104. easy as possible (i.e. boot2docker).