2014-05-05 10:42:23 -04:00
|
|
|
page_title: Installation on Mac OS X
|
|
|
|
page_description: Instructions for installing Docker on OS X using boot2docker.
|
|
|
|
page_keywords: Docker, Docker documentation, requirements, boot2docker, VirtualBox, SSH, Linux, OSX, OS X, Mac
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-05 10:42:23 -04:00
|
|
|
# Installing Docker on Mac OS X
|
2014-04-18 16:21:55 -04:00
|
|
|
|
2014-05-05 10:42:23 -04:00
|
|
|
> **Note:**
|
|
|
|
> Docker is supported on Mac OS X 10.6 "Snow Leopard" or newer.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
The Docker Engine uses Linux-specific kernel features, so to run it on OS X
|
|
|
|
we need to use a lightweight virtual machine (vm). You use the OS X Docker client to
|
|
|
|
control the virtualized Docker Engine to build, run, and manage Docker containers.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
To make this process easier, we've designed a helper application called
|
|
|
|
[Boot2Docker](https://github.com/boot2docker/boot2docker) that installs the
|
|
|
|
virtual machine and runs the Docker daemon.
|
2014-05-05 08:52:12 -04:00
|
|
|
|
2014-06-08 16:11:50 -04:00
|
|
|
## Demonstration
|
|
|
|
|
|
|
|
<iframe width="640" height="360" src="//www.youtube.com/embed/wQsrKX4588U?rel=0" frameborder="0" allowfullscreen></iframe>
|
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
## Installation
|
2014-05-05 08:52:12 -04:00
|
|
|
|
2014-07-01 17:59:28 -04:00
|
|
|
1. Download the latest release of the [Docker for OS X Installer](
|
2014-05-25 21:52:57 -04:00
|
|
|
https://github.com/boot2docker/osx-installer/releases)
|
2014-06-08 18:53:20 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
2. Run the installer, which will install VirtualBox and the Boot2Docker management
|
|
|
|
tool.
|
|
|
|
![](/installation/images/osx-installer.png)
|
2014-06-08 18:53:20 -04:00
|
|
|
|
2014-06-07 21:03:47 -04:00
|
|
|
3. Run the `Boot2Docker` app in the `Applications` folder:
|
|
|
|
![](/installation/images/osx-Boot2Docker-Start-app.png)
|
2014-05-05 08:52:12 -04:00
|
|
|
|
2014-06-22 20:34:04 -04:00
|
|
|
Or, to initialize Boot2Docker manually, open a terminal and run:
|
2014-06-08 18:53:20 -04:00
|
|
|
|
|
|
|
$ boot2docker init
|
|
|
|
$ boot2docker start
|
|
|
|
$ export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
|
2014-05-05 08:52:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
Once you have an initialized virtual machine, you can control it with `boot2docker stop`
|
|
|
|
and `boot2docker start`.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
## Upgrading
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-07-01 17:59:28 -04:00
|
|
|
1. Download the latest release of the [Docker for OS X Installer](
|
2014-05-25 21:52:57 -04:00
|
|
|
https://github.com/boot2docker/osx-installer/releases)
|
2014-06-08 18:53:20 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
2. Run the installer, which will update VirtualBox and the Boot2Docker management
|
|
|
|
tool.
|
2014-06-08 18:53:20 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
3. To upgrade your existing virtual machine, open a terminal and run:
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 18:53:20 -04:00
|
|
|
$ boot2docker stop
|
|
|
|
$ boot2docker download
|
|
|
|
$ boot2docker start
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
## Running Docker
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
From your terminal, you can test that Docker is running with a “hello world” example.
|
|
|
|
Start the vm and then run:
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-25 21:52:57 -04:00
|
|
|
$ docker run ubuntu echo hello world
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
This should download the `ubuntu` image and print `hello world`.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
## Container port redirection
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
The latest version of `boot2docker` sets up a host only network adaptor which provides
|
|
|
|
access to the container's ports.
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
If you run a container with an exposed port,
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-06-12 21:24:09 -04:00
|
|
|
$ docker run --rm -i -t -p 80:80 nginx
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-06-12 21:24:09 -04:00
|
|
|
then you should be able to access that Nginx server using the IP address reported by:
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-06-19 07:00:45 -04:00
|
|
|
$ boot2docker ip
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
Typically, it is 192.168.59.103, but it could get changed by Virtualbox's DHCP
|
|
|
|
implementation.
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
# Further details
|
|
|
|
|
2014-06-13 18:38:45 -04:00
|
|
|
If you are curious, the username for the boot2docker default user is `docker` and the password is `tcuser`.
|
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
The Boot2Docker management tool provides several commands:
|
2014-05-21 17:05:19 -04:00
|
|
|
|
2014-06-08 18:53:20 -04:00
|
|
|
$ ./boot2docker
|
|
|
|
Usage: ./boot2docker [<options>]
|
2014-06-19 07:00:45 -04:00
|
|
|
{help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|delete|download|version} [<args>]
|
2014-05-28 00:42:19 -04:00
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
Continue with the [User Guide](/userguide/).
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-06-08 20:35:49 -04:00
|
|
|
For further information or to report issues, please visit the [Boot2Docker site](http://boot2docker.io).
|