2014-02-04 15:23:09 -05:00
|
|
|
|
:title: Requirements and Installation on Mac OS X 10.6 Snow Leopard
|
|
|
|
|
:description: Please note this project is currently under heavy development. It should not be used in production.
|
|
|
|
|
:keywords: Docker, Docker documentation, requirements, virtualbox, ssh, linux, os x, osx, mac
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 17:16:27 -05:00
|
|
|
|
.. _macosx:
|
2013-08-27 17:29:49 -04:00
|
|
|
|
|
2014-02-04 17:16:27 -05:00
|
|
|
|
========
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Mac OS X
|
|
|
|
|
========
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
.. note::
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
These instructions are available with the new release of Docker
|
|
|
|
|
(version 0.8). However, they are subject to change.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2013-08-28 20:26:10 -04:00
|
|
|
|
.. include:: install_header.inc
|
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Docker is supported on Mac OS X 10.6 "Snow Leopard" or newer.
|
2013-08-28 20:26:10 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
How To Install Docker On Mac OS X
|
|
|
|
|
=================================
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
VirtualBox
|
2013-04-22 21:38:42 -04:00
|
|
|
|
----------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Docker on OS X needs VirtualBox to run. To begin with, head over to
|
|
|
|
|
`VirtualBox Download Page`_ and get the tool for ``OS X hosts x86/amd64``.
|
|
|
|
|
|
|
|
|
|
.. _VirtualBox Download Page: https://www.virtualbox.org/wiki/Downloads
|
|
|
|
|
|
|
|
|
|
Once the download is complete, open the disk image, run the set up file
|
|
|
|
|
(i.e. ``VirtualBox.pkg``) and install VirtualBox. Do not simply copy the
|
|
|
|
|
package without running the installer.
|
|
|
|
|
|
|
|
|
|
boot2docker
|
|
|
|
|
-----------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
`boot2docker`_ provides a handy script to easily manage the VM running the
|
|
|
|
|
``docker`` daemon. It also takes care of the installation for the OS image
|
|
|
|
|
that is used for the job.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
.. _GitHub page: https://github.com/steeve/boot2docker
|
|
|
|
|
|
|
|
|
|
Open up a new terminal window, if you have not already.
|
|
|
|
|
|
|
|
|
|
Run the following commands to get boot2docker:
|
|
|
|
|
|
|
|
|
|
.. code-block:: bash
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 17:29:07 -05:00
|
|
|
|
# Enter the installation directory
|
|
|
|
|
cd ~/bin
|
2014-02-04 15:23:09 -05:00
|
|
|
|
|
|
|
|
|
# Get the file
|
|
|
|
|
curl https://raw.github.com/steeve/boot2docker/master/boot2docker > boot2docker
|
|
|
|
|
|
|
|
|
|
# Mark it executable
|
|
|
|
|
chmod +x boot2docker
|
2013-09-04 20:47:18 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Docker OS X Client
|
|
|
|
|
------------------
|
2013-09-04 20:47:18 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
The ``docker`` daemon is accessed using the ``docker`` client.
|
2013-09-04 20:47:18 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Run the following commands to get it downloaded and set up:
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
.. code-block:: bash
|
2013-04-23 15:04:53 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
# Get the file
|
|
|
|
|
curl -o docker http://get.docker.io/builds/Darwin/x86_64/docker-latest
|
|
|
|
|
|
|
|
|
|
# Mark it executable
|
|
|
|
|
chmod +x docker
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
# Set the environment variable for the docker daemon
|
|
|
|
|
export DOCKER_HOST=tcp://
|
|
|
|
|
|
|
|
|
|
# Copy the executable file
|
|
|
|
|
sudo cp docker /usr/local/bin/
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
And that’s it! Let’s check out how to use it.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
How To Use Docker On Mac OS X
|
|
|
|
|
=============================
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
The ``docker`` daemon (via boot2docker)
|
|
|
|
|
---------------------------------------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 17:29:07 -05:00
|
|
|
|
Inside the ``~/bin`` directory, run the following commands:
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
# Initiate the VM
|
|
|
|
|
./boot2docker init
|
|
|
|
|
|
|
|
|
|
# Run the VM (the docker daemon)
|
|
|
|
|
./boot2docker up
|
|
|
|
|
|
|
|
|
|
# To see all available commands:
|
|
|
|
|
./boot2docker
|
|
|
|
|
|
|
|
|
|
# Usage ./boot2docker {init|start|up|pause|stop|restart|status|info|delete|ssh|download}
|
|
|
|
|
|
|
|
|
|
The ``docker`` client
|
|
|
|
|
---------------------
|
2013-04-23 15:04:53 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Once the VM with the ``docker`` daemon is up, you can use the ``docker``
|
|
|
|
|
client just like any other application.
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
|
|
docker version
|
|
|
|
|
# Client version: 0.7.6
|
|
|
|
|
# Go version (client): go1.2
|
|
|
|
|
# Git commit (client): bc3b2ec
|
|
|
|
|
# Server version: 0.7.5
|
|
|
|
|
# Git commit (server): c348c04
|
|
|
|
|
# Go version (server): go1.2
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
SSH-ing The VM
|
|
|
|
|
--------------
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
If you feel the need to connect to the VM, you can simply run:
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
./boot2docker ssh
|
|
|
|
|
|
|
|
|
|
# User: docker
|
|
|
|
|
# Pwd: tcuser
|
|
|
|
|
|
|
|
|
|
You can now continue with the :ref:`hello_world` example.
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Learn More
|
|
|
|
|
==========
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
boot2docker:
|
|
|
|
|
------------
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
See the GitHub page for `boot2docker`_.
|
2014-01-15 19:17:23 -05:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
.. _boot2docker: https://github.com/steeve/boot2docker
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
If SSH complains about keys:
|
|
|
|
|
----------------------------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
ssh-keygen -R '[localhost]:2022'
|
2013-04-23 15:04:53 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
About the way Docker works on Mac OS X:
|
|
|
|
|
---------------------------------------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
2014-02-04 15:23:09 -05:00
|
|
|
|
Docker has two key components: the ``docker`` daemon and the ``docker``
|
|
|
|
|
client. The tool works by client commanding the daemon. In order to
|
|
|
|
|
work and do its magic, the daemon makes use of some Linux Kernel
|
|
|
|
|
features (e.g. LXC, name spaces etc.), which are not supported by OS X.
|
|
|
|
|
Therefore, the solution of getting Docker to run on OS X consists of
|
|
|
|
|
running it inside a lightweight virtual machine. In order to simplify
|
|
|
|
|
things, Docker comes with a bash script to make this whole process as
|
|
|
|
|
easy as possible (i.e. boot2docker).
|